Removing the Close, Min, Maximize and frame with ANY gui toolkit
Mike Driscoll
kyosohma at gmail.com
Tue Feb 5 13:41:15 EST 2008
On Feb 5, 11:17 am, Daniel Folkes <danfol... at gmail.com> wrote:
> I was wondering if anyone knew how to remove the Minimize, Maximize
> and Close from the frame around a gui.
> Removing everything would work even better.
>
> I would prefer instructions for tkinter, but any GUI would
> suffice(glade, gtk, wx, Qt). I really would like to make a widget
> like object instead of a window.
>
> Thanks,
> Daniel Folkeshttp://danfolkes.com
I've only ever dabbled with Tkinter, so I'm not sure what its syntax
is. However, with wxPython, it's fairly trivial:
<code>
import wx
class MyPopup(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, 'Test Frame',
#size=(450,295),
style=wx.STAY_ON_TOP # forces the window to be
on top / non-modal
##|wx.DEFAULT_FRAME_STYLE # enable this to get the
min/max/close buttons
## |wx.CLOSE_BOX
|wx.CAPTION
|wx.RESIZE_BORDER)
btn = wx.Button(self, wx.ID_ANY, 'Close')
self.Bind(wx.EVT_BUTTON, self.close, btn)
# display the frame
self.Show()
def close(self, event):
self.Close(True)
if __name__ == '__main__':
app = wx.PySimpleApp()
MyPopup()
app.MainLoop()
</code>
I included a close button as it can be a pain to close these suckers
when you disable the default buttons. I read in the last week or two
that there's some Linux variant out there that will display the
minimize button regardless.
If all you want is a non-modal dialog, you might look at the wx.Dialog
widget or one of the popup widgets. There's also a Toaster widget...
I found this link about Tkinter:
http://mail.python.org/pipermail/python-list/2002-July/153111.html
Hope that helps you.
Mike
More information about the Python-list
mailing list