I have a Python script that creates a Tkinter window running in Ubuntu. In the script I have an if/else statement that changes the background color based on a variable. That all works. What I cannot figure out how to do is when it changes the background color, I also want it to unminimize the window if it is minimized to the tray at the time.
Thanks
Frank

Recommended Answers

All 7 Replies

I have a Python script that creates a Tkinter window running in Ubuntu. In the script I have an if/else statement that changes the background color based on a variable. That all works. What I cannot figure out how to do is when it changes the background color, I also want it to unminimize the window if it is minimized to the tray at the time.
Thanks
Frank

I believe that this would be a function of the operating system. If this is true, how do I get the script to send the command to os? Can someone direct me to the proper place to find this information. Is this even possible in Ubuntu?
Thanks

I would approach this by looking documentation for way to generate restore window event in Tkinter. The program would behave the same as user had clicked the program unminimized (restored). Should be portable also.

I would approach this by looking documentation for way to generate restore window event in Tkinter. The program would behave the same as user had clicked the program unminimized (restored). Should be portable also.

Thanks. After looking briefly I think this will get me going in the right direction.
Frank

Actually this is more a function of the desktop, each of which has wrappers to perform this function. KDocker for KDE is only one that comes to mind right now but there are sure to be more, perhaps one or two that are not desktop specific.

I would approach this by looking documentation for way to generate restore window event in Tkinter. The program would behave the same as user had clicked the program unminimized (restored). Should be portable also.

Thanks. I finally found the answer. Turned out to be a real simple one line of code

root.wm_state('normal')

.
But learned a whole lot more searching for the answer. :)

commented: Nice to share your find +1

Thanks. I add it in my set(trics) (bag of trics :) )

+1 I didn't know that either.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.