anyone know how to hide python GUI Tkinter, I 've created keylogger, for GUI I used python module Tkinter , I want to add button called HIDE, so when user click it it will hide GUI , and when user press key like CTRL+E , it should unhide GUI....?
4 Answers
To hide the default root window you can use
root.withdraw()
and to make it visible again you can use
root.deiconify()
2 Comments
blaz1988
I tried to add root.withdraw() exitButtonPushed(), instead root.destroy() , but it wont work , see code above
blaz1988
thx, I will try another way , I will run keylogger.py when user click RUN , and when uses click HIDE it will exit from gui, but keylogger.py will stay running
If you want to "hide" the window (NOT destroy it) and bring it back, then the way to do that is set the alpha channel.
To hide the window, set the alpha channel to 0:
master.attributes('-alpha', 0)
to restore the window set alpha to 1.0:
master.attributes('-alpha', 1.0)
[EDIT - had the incorrect type/range for the original answer. Range is 0 to 1.0 and is a float]
2 Comments
Mike from PSG
Thanks for the comment. Yea, I blew that answer originally.
To get rid of a GUI window I used the following in my code.
window.destroy()
and the following to bring it up again.
nameoffunction() window.lift()
1 Comment
Bryan Oakley
window.destroy does nothing. If you want to call the destroy method you must include parenthesis: window.destroy(). If you call that on the root window, the program will exit.