python - PyQt - How do I fade the desktop background behind a dialog (similar to Windows UAC)? -


i'm wondering if pyqt in python has capability, possible have dialog in center of screen(i know possible) , sourounding area out side of dialog has opacity of of 50 percent basicly still visable can't totatlly see it. possible? make sure understand im talking outside of dialog box not inside. want simple lockscreen app not secure i'll work on later. have tried

self.setwindowopacity(.8) 

but applies window want affet outside

i know doesn't sound easy understand if need more explanation let me know in comments.

do want background (desktop) have less opacity? there's nothing "behind" background, changing opacity doesn't make sense. guess want similar how windows uac dialog works. when install software confirm dialog shows , rest of screen goes blackish.

this can emulated creating fullscreen borderless window in single color reduced opacity , open dialog on top of that.

for frameless/borderless window find references qtcore.qt.framelesswindowhint , method called qwindow.setmask(). either 1 might work.

heres example of framelesswindowhint usage.

hope helpful.

edit: added code example (based on example link):

import sys pyside import qtcore, qtgui  class mywindow(qtgui.qmainwindow):     def __init__(self, parent=none):         super(mywindow, self).__init__(parent)         self.setwindowflags(qtcore.qt.framelesswindowhint)         self.b = qtgui.qpushbutton("exit", self, clicked=self.close)         self.setwindowopacity(.8)         self.setstylesheet("qmainwindow { background: 'black'}");          self.dialog = qtgui.qdialog()         self.dialog.setmodal(true)         self.dialog.show()  if __name__ == "__main__":     app = qtgui.qapplication(sys.argv)     myapp = mywindow()     myapp.setgeometry(app.desktop().screengeometry())     myapp.show()     sys.exit(app.exec_()) 

this work single screen. you'll have enumerate screens , create window each seperate screen cover multi-screen setups. i'll leave exercise you.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -