Bug in pybwidgets, or my code?

Kevin Walzer kw at codebykevin.com
Fri Dec 8 16:16:01 EST 2006


I'm trying to use pybwidgets in a Tkinter application I'm developing; the
BWidgets listbox supports insertion of images alongside text, and is
nicer than the alternatives I've looked at (various tree widgets, for
instance).

I've found what I think is a bug. When the BWidgets listbox is placed
inside a panedwindow, it does not properly display the
selectforeground/selectbackground colors--in fact, it provides no visual
feedback at all that a listbox item is selected.

The following code illustrates the problem. The listbox does respond to
button events; when an item is selected, text is printed to the text
widget. But there is no visual selection feedback in the listbox itself.
Can someone review this, test it, and let me know if I'm doing something
wrong, or if this is in fact a bug? Thanks.

---
import Tkinter
from bwidget import *
import bwidget

root = Tkinter.Tk()
right = ""

m = Tkinter.PanedWindow(root, orient="horizontal")
m.pack(fill="both", expand=1)



left = ListBox(m, selectbackground="black", selectforeground="white")
m.add(left)

for text in "abcde":
    left.insert("end", text=text*3)

left.bind_text("<Button-1>", (lambda event: printstuff()))

right = Tkinter.Text(m)
m.add(right)

right=right

def printstuff():
    global right
    right.insert("end", "pressed\n")

root.mainloop()


-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com



More information about the Python-list mailing list