osx tkinter listbox problem

James Stroud jstroud at mbi.ucla.edu
Mon Mar 26 17:21:30 EDT 2007


Ben Collver wrote:
> I am using Darwin 10.4.9, tcl 8.4.7, tk 8.4, and python 2.3.5.  I have 
> also tried Python 2.5 on Darwin, Debian, and Fedora Core 6.
> 
> I am working on a GUI front-end to a Python program of mine.  It is a 
> simple grid with labels in the left column and input widgets in the 
> right column.  One of the rows has a listbox in the right column.  The 
> listbox contains two items.  I select one using widget.select_set(). The 
> GUI is not complete yet, because I am still learning about Python and 
> Tkinter.
> 
> On Linux, the GUI works as expected.  On OSX, when select_set() runs, 
> the listbox disappears from its place in the grid, and appears in the 
> upper left corner of the window.  Here are screen shots to illustrate.
> http://terrorpin.net/~ben/docs/alt/music/soundfont/pysf-wip/pysfi-debian.jpg 
> 
> http://terrorpin.net/~ben/docs/alt/music/soundfont/pysf-wip/pysfi-osx.png
> 
> The GUI code itself is at the following location.
> http://terrorpin.net/~ben/docs/alt/music/soundfont/pysf-wip/pysfi.py
> 
> To run, it needs the Python program at the following location.
> http://terrorpin.net/~ben/docs/alt/music/soundfont/pysf-wip/pysf.py
> 
> Why does the listbox change position at all?  Am I using listbox 
> incorrectly?
> 
> Thank you,
> 
> Ben
> 
> 

I think you couldn't be using Listbox more correctly.

It looks like Tk aqua is broke here--which is not unusual because its 
still evolving. Perhaps you could file a bug report?

A "cross platform" work-around might be to grid a frame at the row and 
column of self.Main and pack the Listbox into the Frame. I don't have a 
Mac at work to test this, however. But I would be curious to know your 
results if you try it.

James



More information about the Python-list mailing list