Simple Tk8 Problems

Nick Bower nick.bower at ssec.wisc.edu
Sat Jul 10 23:26:13 EDT 1999


Hi,

I'm currently having 2 simple, but I think fundamental, problems with my
understanding of Tk 8.

1.  I can't control the size of the Tk root window.  I've tried putting
".width=xxx" statements everywhere in the following snippet, but nothing
seems to work.  (The FileList is a ListBox next to a scrollbar).  Is
there something I'm missing?.

class FileList(Frame):
  def __init__(self,parent):
    Frame.__init__(self,parent)
    self.filelist=Listbox(self)
    self.scroll=Scrollbar(self)
    self.filelist.config(yscrollcommand=self.scroll.set,relief=SUNKEN)
    self.filelist.pack(side=LEFT,expand=YES,fill=BOTH)
    self.scroll.config(command=self.filelist.yview,relief=SUNKEN)
    self.scroll.pack(side=RIGHT,expand=NO,fill=Y)

<etc>

if __name__ == '__main__':
  toplevel = Tk()
  afilelist=FileList(toplevel)
  afilelist.pack(expand=YES,fill=BOTH)
  afilelist.mainloop()


2. Also, the Listbox in the above code is scrolling all over the place
tracking the mouse movement as it runs across the top of it.  I don't
even need to touch the scrollbar and it seems to track mouse movement so
somehow it's been bound to the mouse as well as the scroll bar.  Weird.


Thanks in advance for help (again)  :)

nick


--

Nick Bower
Space Science and Engineering Center
University of Wisconsin, Madison, USA
Phone: (608) 265 8007
Email: nick.bower at ssec.wisc.edu
Web: http://arm1.ssec.wisc.edu/~nickb







More information about the Python-list mailing list