-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTK_Example2.py
More file actions
24 lines (21 loc) · 766 Bytes
/
Copy pathTK_Example2.py
File metadata and controls
24 lines (21 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from tkinter import *
"""A simple hello world example
We create a label inside our application with the text Hello World and
configure the foreground colour to be red."""
class App(Frame):
"""Our Application. We inherit all the properties
and methods of a Tkinter Frame"""
def __init__(self,master=None):
Frame.__init__(self,master)
self.lblHello = Label(self,text="Hello World")
self.lblHello['fg'] = "red"
self.lblHello.grid()
self.btnStart = Button(self,text="Click Me")
self.btnStart.grid()
def main():
root = Tk()
app = App(master=root)
app.grid()
"""This is the code that is executed by python when we run this .py file"""
if __name__ == '__main__':
main()