How can I change size of GUI?
Eric Brunel
eric.brunel at nospam-pragmadev.com
Tue Apr 7 03:30:26 EDT 2009
Muddy Coder wrote:
> Hi Folks,
>
> I copied code from book:
>
> class ScrolledText(Frame):
> def __init__(self, parent=None, text='', file=None):
> Frame.__init__(self, parent)
> self.pack(expand=YES, fill=BOTH)
> self.makeWidgets()
> self.settext(text, file)
> def makeWidgets(self):
> sbar = Scrollbar(self)
> text = Text(self, relief=SUNKEN, width=120)
> sbar.config(command=text.yview)
> text.config(yscrollcommand=sbar.set)
> sbar.pack(side=RIGHT, fill=Y)
> text.pack(side=LEFT, expand=YES, fill=BOTH)
> self.text = text
>
> It works, of course. But, the GUI is small, and I want to enlarge it.
> I tried to add in options of width=120 for Text(), but it did not
> work. Can somebody drop me a couple of lines for help? Thanks!
For what definition of 'did not work'? Seems perfectly fine to me. Just try to
add the lines:
root = Tk()
frm = ScrolledFrame(root)
frm.pack()
root.mainloop()
to the end of your code above, remove the line self.settext(text, file) which
calls a method that doesn't exist, then run it with your option width=120,
then without, and I can guarantee you'll see a difference (I do anyway...).
So I guess this code is part of a much bigger one, and that the problem lies
in the other part...
HTH anyway...
- Eric -
More information about the Python-list
mailing list