How to use tk.call ?

jerry.levan at gmail.com jerry.levan at gmail.com
Mon May 29 19:10:11 EDT 2006


Hi,

I am trying to port one of my Tcl/Tk apps to Python ( 2.4.2/3).
One task is to try to be able to use my wheel mouse to scroll a Tktable
object.

The tcl code looks like:
  #Support the MouseWheel

    bind $ui_vars(table) <Button-4> { $ui_vars(table) yview scroll -5
units }
    bind $ui_vars(table) <Button-5> { $ui_vars(table) yview scroll +5
units }
    bind $ui_vars(code)  <Button-4> { $ui_vars(code)  yview scroll -5
units }
    bind $ui_vars(code)  <Button-5> { $ui_vars(code)  yview scroll +5
units }

$ui_vars(table) is the table and $ui_vars(code) is a text widget.

on the python side I can get scrolling in the text widget by
        # Support for mouse wheel
 self.command.bind("<Button-4>",self.command.yview_scroll(-5 ,'units'))
 self.command.bind("<Button-5>",self.command.yview_scroll(5,'units'))

Unfortunately the python Tkinter Table widget does not support the
yview_scroll command.

I have tried the following:

self.table.bind("<Button-4>",self.table.tk.call(self.table._w,'yview','scroll',-5,'units')
but, alas nothing happens....

I can't find how too use tk.call, can anyone give me a clue as to how
to
solve my problem?

Thanks,

Jerry




More information about the Python-list mailing list