Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_RGB.py
- from Tkinter import *
- root=Tk()
- def cmd(event):
- r=red.get()
- g=green.get()
- b=blue.get()
- color='#%02x%02x%02x' % (r,g,b)
- if color <> sample.prev:
- sample.prev=color
- print color
- sample.configure(background=color)
- for z in lz:
- z.configure(background=color)
- #
- sample=Frame(root)
- sample.pack(fill=BOTH,expand=1)
- la=Label(sample,text='')
- lb=Label(sample,text='-- SAMPLE --')
- lc=Label(sample,text='-- SAMPLE --', fg='WHITE')
- ld=Label(sample,text='')
- lz=la,lb,lc,ld
- for z in lz:
- z.pack(fill=BOTH,expand=1)
- red= Scale(root,orient='horizontal',label='RED',to=255,length='5c')
- red.pack(fill=X)
- green= Scale(root,orient='horizontal',label='GREEN',to=255,length='5c')
- green.pack(fill=X)
- blue= Scale(root,orient='horizontal',label='BLUE',to=255,length='5c')
- blue.pack(fill=X)
- sample.prev=''
- red.configure(command=cmd)
- green.configure(command=cmd)
- blue.configure(command=cmd)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement