Created
January 12, 2014 04:26
-
-
Save Himanshu-Mishr/8380828 to your computer and use it in GitHub Desktop.
gui example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
shows out a single button GUI in this way as a class | |
''' | |
from tkinter import * | |
from tkinter.messagebox import showinfo | |
class MyGUI(Frame): | |
def __init__(self, parent=None): | |
Frame.__init__(self, parent) | |
button = Button(self, text='press', command=self.reply) | |
button.pack() | |
def reply(self): | |
showinfo(title='reaction', message=' button pressed') | |
if __name__ == '__main__': | |
window = MyGUI() | |
window.pack() | |
window.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment