[Tkinter-discuss] Please help -- Pmw PanedWidget inside
ScrolledFrame
Jared Cohen
Jared.Cohen at noaa.gov
Fri Jan 7 18:24:34 CET 2005
I'm trying to use a Pmw.ScrolledFrame which contains a PanedWidget. But
I can't get the PanedWidget to expand to fill the interior frame. It
expands fine if I just grid it into the toplevel window; and when I
tried gridding DIFFERENT widgets into the ScrolledFrame, they expanded
just fine. So both the ScrolledFrame and PanedWidget seem to work OK on
their own, but when I try to put one inside the other, something goes
wrong. Can anyone help please?
Here's the sample code I'm using:
#!/usr/bin/env python
import sys, os, Tkinter, types, tkFont, Pmw
def makeResizable(widget):
for i in range(0, widget.grid_size()[0]):
widget.columnconfigure(i, weight=1)
for i in range(0, widget.grid_size()[1]):
widget.rowconfigure(i, weight=1)
def main():
root = Tkinter.Tk()
root.geometry("500x500+0+0")
Pmw.initialise(root)
scrolledFrame = Pmw.ScrolledFrame(root,
usehullsize=1,
borderframe=0,
hscrollmode='static',
vscrollmode='static')
scrolledFrame.grid(row=0, rowspan=20, column=0, columnspan=20,
sticky='nsew')
panes = Pmw.PanedWidget(scrolledFrame.interior(),
orient='horizontal',
hull_borderwidth=2,
hull_relief='sunken')
panes.grid(row=0, rowspan=20, column=0, columnspan=20, sticky='nsew')
for i in range(5):
pane = panes.add("pane"+str(i), size=1/5.0)
button = Tkinter.Button(pane, text="This Is A Very Long Name For
A Button")
button.grid(row=0, rowspan=1, column=i, columnspan=1, sticky='nsew')
makeResizable(root)
makeResizable(scrolledFrame.interior())
makeResizable(panes)
root.mainloop()
if __name__=='__main__': main()
More information about the Tkinter-discuss
mailing list