two questions on tkinter
Warren Kirk
warrenk at Zem.Zem
Thu Aug 22 11:11:40 EDT 2002
Michele Simionato <mis6 at pitt.edu> wrote:
>
>1. First, how do I bind special keys like #,$,>,<,;0123456789 etc ? How
>do I bind Space key ? Are the Windows keys recognized ?
>
This is the program I use to find keysyms on X11.
from Tkinter import *
class Output(Label):
def printkey(self, event):
self.config(text=event.keysym)
root = Tk()
label = Label(root, text='Press a key...')
output = Output(root, takefocus=1)
label.pack()
output.pack()
output.focus()
output.bind('<KeyPress>', output.printkey)
root.mainloop()
>2. How do I use colors in the Text widget ? For instance I would like to
>write RED GREEN BLUE with RED in red, GREEN in green and BLUE in blue.
>
You need to read about 'tags' in the Text widget documentation.
>TIA,
>
> Michele
HTH,
Warren
More information about the Python-list
mailing list