Font size
Fredrik Lundh
fredrik at pythonware.com
Thu Feb 17 02:45:00 EST 2005
"Adam" <adam at eden.com> wrote:
> So we came up with the idea of using a random number generator to
> generate numbers from 0 to 36 and display them in large figures on my
> laptop. This is for the benefit of those people who are hard of hearing.
> They like to see what is happening.
here's one way to do this:
from Tkinter import *
from random import randint
from time import sleep
def update(event=None):
for i in range(10):
label.config(text=str(randint(0,36)))
label.update()
sleep(0.05)
# create a maximized window
root = Tk()
root.wm_state("zoomed")
root.title("my roulette wheel")
# 80% of the screen height
height = int(root.winfo_screenheight() * 0.8)
# create label (use negative font size for size in pixels)
label = Label(root, font="Arial " + str(-height), bg="gold")
label.pack(fill=BOTH, expand=1)
# click anywhere in window to pick a new number
root.bind("<Button-1>", update)
update() # display first number
mainloop()
(tweak as necessary)
</F>
More information about the Python-list
mailing list