'''Tkinter tutorial value PaneWindow '''
# PaneWindow (panel) is a gm used to manage child Widgets
'''1. Add Pane ''' to the PanedWindow '''
# Use the add Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Panes = PanedWindow (orient = VERTICAL)
Panes. pack (fill = BOTH, expand = 1)
For w in [Label, Button, Checkbutton, Radiobutton]:
Panes. add (w (panes, text = 'hello '))
Root. mainloop ()
# Create a widget in each pane
'''2. Delete the pane ''' specified by PanedWindow '''
# Use the forget/remove Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Ws = []
Panes = PanedWindow (orient = VERTICAL)
Panes. pack (fill = BOTH, expand = 1)
# Create four pane
For w in [Label, Button, Checkbutton, Radiobutton]:
Ws. append (w (panes, text = 'hello '))
For w in ws:
Panes. add (w)
# Delete pane containing sub-buttons from panes and use remove to be the same as forget
Panes. forget (ws [1])
# Panes. remove (ws [1])
Root. mainloop ()
# There are only three widgets, and the Button has been deleted.
''' 3. Add a pane ''' at the specified position in the PanedWindow '''
# Use the paneconfig Method
#-*-Coding: cp936 -*-
From Tkinter import *
Root = Tk ()
Ws = []
Ps = PanedWindow (orient = VERTICAL)
Ps. pack (fill = BOTH, expand = 1)
# Create four pane
For w in [Label, Button, Checkbutton, Radiobutton]:
Ws. append (w (ps, text = 'hello '))
For w in ws:
Ps. add (w)
# Add a Lable after 0. An error occurred !!!
# Ps. after (ws [0], Label (ps, text = 'World '))
# Note that the added widget is the first parameter, and the after parameter is specified after that widget.
# Do not confuse it with the after Method
Ps. paneconfig (Label (ps, text = 'World'), after = ws [0])
Root. mainloop ()
# This widget is mainly used for Container and uses a large number of gm methods.
# Author: jcodeer
# Blog: jcodeer.cublog.cn
# Email: jcodeer@126.com