hello world using tkinter
Though personally, I prefer wx over Tkinter, here's a sample hello world application, if you are really trying to start with GUI application in python using Tkinter.
#!/usr/bin/python
import Tkinter
import tkMessageBox
class MyGUI:
def __init__(self):
self.main_window=Tkinter.Tk()
self.label=Tkinter.Label(self.main_window,text='Hello World')
self.label.pack()
Tkinter.mainloop()
my_gui=MyGUI()
The output should be as follows:
#!/usr/bin/python
import Tkinter
import tkMessageBox
class MyGUI:
def __init__(self):
self.main_window=Tkinter.Tk()
self.label=Tkinter.Label(self.main_window,text='Hello World')
self.label.pack()
Tkinter.mainloop()
my_gui=MyGUI()
The output should be as follows:
Comments
Post a Comment