22
loading...
This website collects cookies to deliver better user experience
Recap: Tkinter is an inbuilt python library for handling GUI. More about it here
import tkinter
master=Tk()
master.geometry('400x200+100+100')
import tkinter
We first import Tkinter. We can also use import tkinter as tk
or from tkinter import *
to reduce the typing 'tkinter.abc()' everytime.
master=Tk()
Create an instance of Tkinter frame or window. Here 'master' is an instance of the window object.
master.geometry('400x200+100+100')
Set the geometry of Tkinter frame. We will understand what the parameters mean in a moment.
import tkinter
master=tkinter.Tk()
master.geometry('300x100')
master.title("My First Program")
Tk()
instance). After we do that, we then need to place the widget in a proper coordinate on the frame. We do that using the place()
attribute. The place attribute takes two inputs, the x and the y values of the coordinates. place(x = 150, y = 150)
import tkinter
master=tkinter.Tk()
master.geometry('300x300')
master.title("My First Program")
label = tkinter.Label(master, text = "Hello world").place(x = 150, y = 150)