Newbie Tkinter problem...

Peter Abel p-abel at t-online.de
Sun Aug 31 01:08:38 CEST 2003


Baltor <member37516 at dbforums.com> wrote in message news:<3306631.1062265710 at dbforums.com>...
> I am trying to attach a scollbar to a text field. This is the code
> I am using:
> 
> 
> 
> # Scroll Bar and Text Box
> 
>         self.scrollbar = Scrollbar(master, orient=VERTICAL)
> 
>         self.scrollbar.pack(side=RIGHT, fill=Y)
> 
>         self.text = Text(master, height=5, width=20, state=DISABLED,
>         yscrollcommand=self.scrollbar.set)
> 
>         self.text.grid(row=2, column=1, rowspan=2)
> 
>         self.scrollbar.config(command=self.text.yview)
> 
> 
> 
> When I run the program, the program freezes and I have to Ctrl-Alt-
> Delete put of it. What's wrong?
> 
> Thanks in advance.

You did something you should never do in Tkinter, that's mixing
the pack- and the grid-manager.

instead of:
>         self.scrollbar.pack(side=RIGHT, fill=Y)
try:
         self.scrollbar.grid(row=2, rowspan=2, column=2)

This should help.

Regards
Peter




More information about the Python-list mailing list