Hi Rob,
Complete solution, with a re-usable ScrolledListBox class,
below:
from tkinter import *
class ScrolledListBox(Frame):
def __init__(self, master, items=[], width=24, height=20,
bgcol="white", **keywords):
Frame.__init__(self, master)
self.config(bg=bgcol)
# S
A listbox can only scroll text. So, to display a colored word you would use
the "itemconfig" method to change the background and foreground of each
element individually.
For example:
for index, color in enumerate(colors):
listbox.insert("end", color)
listbox.itemco
Hi,
On Thu, 16 Jan 2014 17:06:26 +1100
"Rob Ward" wrote:
> Hi Folks,
> Sorry to be back so soon but I have another challenge.
No problem, that's what this list was made for ;)
(...)
> mylist = Listbox(root, yscrollcommand = scrollbar.set )
> for c in COLORS:
> e = Label(mylist, text = c,
Hello Rob,
as far as I remember you can only insert text into a Listbox.
Maybe you pack Widgets onto a Listbox they appear but it does not make
them items.
Try this:
mylist.insert(END,*c* )
mylist.itemconfigure(END, background = c)
If you want to change the background.
Greetings,
Nicco
A
Hi Folks,
Sorry to be back so soon but I have another challenge. I wanted to choose some
colours for my program and came across a program that claimed to list the
colours in a nifty little Python program. Cute I thought, I must try that.
Quite a few hours later I am stumped. Here is the code