Hi,

Im a novice in Python, using Tkinter for the GUI developement.
I am trying to figure out how to create my frame such that you cannot exit using the title little 'x' in the corner.
In fact I dont want it at all!

I did try overriding it by

def DontQuit(self):
print 'Sorry,not going to quit!'

top.protocol("WM_DELETE_WINDOW", lambda:self.DontQuit())

where I refused to destroy the frame (and it worked), but is there any way I can take out the title bar altogether?

Any ideas?
Thanks!
Pree

Recommended Answers

All 2 Replies

I don't think the Tkinter GUI toolkit as a no-title bar style option. For those kind of details you will have to use the wxPython GUI toolkit which has a style=wx.MINIMIZE_BOX, and then provide a means to exit your program some other way (popup menu or button).

Here is a very simple example ...

# wx.Frame with no title bar

import wx

def exit(event):
    frame.Close(True)
    
app = wx.PySimpleApp()
# create a window, no-parent, -1 is default ID, style with no titlebar
frame = wx.Frame(parent=None, id=-1, pos=(50,100), 
    size=(300,200), style=wx.MINIMIZE_BOX)
frame.SetBackgroundColour('green')

# provide exit for a frame without titlebar
quit1 = wx.Button(frame, id=-1, label='Exit', pos=(0,170))
quit1.Bind(wx.EVT_BUTTON, exit)

# show the window
frame.Show(True)

# start the event loop
app.MainLoop()

I think what you are looking for is the overrideredirect flag. This tells the wm to buzz-off.

It is generally used for pop-up windows (like balloon pop-ups, menus, etc.).
It is generally a Bad Idea for use with your main application window.

Hope this helps.

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.