Install Python and python tk by
To Run Python
e.g python tkhello.py
1. Simple Hello World program
2. Program with exit button
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