[pygtk] how to cut off the maximum button in the window?

Tim Evans t.evans at aranz.com
Mon Oct 12 12:34:21 WST 2009


Marco Antonio Islas Cruz wrote:
> set the window property 'resizable' to false.
> 
> On Mon, 2009-10-12 at 11:28 +0800, holmes86 wrote:
>> Hi,everyone
>> I set window size 800x600,and I don't need window to maximum.So I want
>> to cutting off the maximum button in the window.How can do it?
>> thanks very much

Alternatively, set the "decorations" of the underlying GdkWindow.  The 
full list of decorations is: 'border', 'resizeh', 'title', 'menu', 
'minimize', 'maximize'.  It depends on your OS (and for Linux your 
window manager) which of these can be switched off.  Code would look 
something like this:

   decor = 'border', 'resizeh', 'title', 'menu', 'maximize' # no maximize
   window.window.set_decorations(decor)

Note that you need to wait for the GtkWindow to be realized before you 
can access its GdkWindow.  Handling the 'realize' signal is the normal 
way to do that, so code often ends up looking like this:

   def on_realize_set_decor(window, decor):
       window.window.set_decorations(decor)

   decor = 'border', 'resizeh', 'title', 'menu', 'maximize' # no maximize
   window.connect('realize', on_realize_set_decor, decor)

-- 
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/


More information about the pygtk mailing list