Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimizing a Tk Window

I have a window I made with Tkinter, I'd like to be able to minimize it. This is in Windows 7 FYI.

like image 486
rectangletangle Avatar asked Dec 19 '10 06:12

rectangletangle


People also ask

How to minimize a window in tkinter?

In Tkinter, minsize() method is used to set the minimum size of the Tkinter window. Using this method user can set window's initialized size to its minimum size, and still be able to maximize and scale the window larger. Here, height and width are in pixels.

How do I lock the size of a tkinter window?

Locking window size simply means the user won't be able to change the window size. To do so, we will pass (0,0) in the resizable method. Here 0,0 refers to False for width & Height. resizable method instructs window manager if this window can be resized or not.

How to maximize window in tkinter?

We can customize the geometry of the window using the geometry method. However, in order to maximize the window, we can use the state() method which can be used for scaling the tkinter window. It maximizes the window after passing the “zoomed” state value to it.


1 Answers

>>> import Tkinter
>>> w = Tkinter.Tk()
>>> w.wm_state('iconic')

Should work and minimize the window to the taskbar.

To minimize it to the taskbar as a button:

w.iconify()
like image 132
user225312 Avatar answered Sep 19 '22 11:09

user225312