0
 Install Python and python tk by

sudo apt-get install python python-tk

To Run Python

python filename.py

e.g python tkhello.py


1. Simple Hello World program


import Tkinter
top=Tkinter.Tk()
label=Tkinter.Label(top,text="hello world")
label.pack()
Tkinter.mainloop()





2. Program with exit button

import Tkinter
top=Tkinter.Tk()
hello=Tkinter.Label(top,text="hello");
hello.pack()
quit=Tkinter.Button(top,text="quit",command =top.quit,bg="red",fg="white")
quit.pack(fill=Tkinter.X,expand=1)
Tkinter.mainloop()





Post a Comment

Emoticon
:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Top