I have a Tkinter app that works for me until I use Toplevel to add a title.
My efforts to use Toplevel have confused me, bringing an additional
unwelcome blank window that I don't understand how to manage.

The question is simply "how do I confer Toplevel methods to a top level
PanedWindow and still have the application run in a single window?"

Thank you for any direct help or pointers to code that works that I could
understand.

Regards,
Geoff

----------------------------------------------------------
"""
Example modified from Fredrik Lundh's 3-paned window on
http://effbot.org/tkinterbook/panedwindow.htm
"""
from Tkinter import *

class TkApp():

    def __init__(self, parent=None, idtext=''):
        self.idtext = idtext
        self.mainpane = PanedWindow(parent)
        self.mainpane.pack(fill=BOTH, expand=1)
        self.createWidgets()

    def createWidgets(self):       
        # left
        self.left = Label(self.mainpane, text=self.idtext+"left pane")
        self.mainpane.add(self.left)
        # right
        self.right = PanedWindow(self.mainpane, orient=VERTICAL)
        self.mainpane.add(self.right)
        # top of the right pane
        self.top = Label(self.right, text=self.idtext+"top pane")
        self.right.add(self.top)
        # botton of the right pane
        self.bottom = Label(self.right, text=self.idtext+"bottom pane")
        self.right.add(self.bottom)

if __name__ == '__main__':
    # A window that works but you can't add a title
    tk1 = TkApp(idtext="App1 ")
    # comment next line out when using IDLE
    #mainloop()
----------------------------------------------------------

Alternative main ...

if __name__ == '__main__':
    # A window that works but comes with an additional blank window
    tk2 = Toplevel()
    tk2.title("Title2")
    tk3 = TkApp(tk2, "App2 ")
    # comment next line out when using IDLE
    #mainloop()


-- 
View this message in context: 
http://www.nabble.com/Toplevel---failure-to-understand-it-tp18312052p18312052.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to