334bced0c551c2a37a233ed8c5023509131dabf7
title
= 'Pmw.PanedWidget demonstration (pane factory)'
# Import Pmw from this directory tree.
sys
.path
[:0] = ['../../..']
def __init__(self
, parent
):
# Create a "pane factory".
label
= Tkinter
.Label(parent
,
text
= 'Below is a simple "pane factory".\n' +
'Drag the handle on the left\nto create new panes.')
self
.factory
= Pmw
.PanedWidget(parent
,
hull_width
=300, hull_height
=200
self
.factory
.add('starter', size
= 0.0)
button
= Tkinter
.Button(self
.factory
.pane('main'),
self
.factory
.pack(expand
= 1, fill
= 'both')
# Remove any panes less than 2 pixel wide.
for i
in range(len(list) - 1, 0, -1):
# If the user has dragged the left hand handle, create a new pane.
self
.paneCount
= self
.paneCount
+ 1
# Add a button to the new pane.
name
= self
.factory
.panes()[0]
text
= 'Pane\n' + str(self
.paneCount
)
button
= Tkinter
.Button(self
.factory
.pane(name
), text
= text
)
# Create a new starter pane.
name
= 'Pane ' + str(self
.paneCount
)
self
.factory
.insert(name
, size
=0.0)
######################################################################
# Create demo in root window for testing.
if __name__
== '__main__':
exitButton
= Tkinter
.Button(root
, text
= 'Exit', command
= root
.destroy
)
exitButton
.pack(side
= 'bottom')