How can I change size of GUI?
eric.brunel at nospam-pragmadev.com
Tue Apr 7 09:30:26 CEST 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.settext(text, file)
> def makeWidgets(self):
> sbar = Scrollbar(self)
> text = Text(self, relief=SUNKEN, width=120)
> 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)
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...
- Eric -
More information about the Python-list