DEV Community

Blackmare01wolf
Blackmare01wolf

Posted on • Edited on

Tkinter GUI guide

1.Create the window

from tkinter import *

b = Tk()
b.title("tkinter project")
b.geometry("400x300")
b.minsize(400,400)

b.mainloop()
Enter fullscreen mode Exit fullscreen mode

2.Label(Display text)

from tkinter import *

b = Tk()

l1 = Label(b, text="Blackmare01wolf", font=("arial",14), fg="black", bg="blue")
l1.place(x=0, y=0)

b.mainloop()
Enter fullscreen mode Exit fullscreen mode

3.Button(Clickable Button)

from tkinter import *

b = Tk()

b1 = Button(b, text="Blackmare01wolf", font=("arial",14), fg="black", bg="blue", bd=5, relief=RIDGE)
b1.place(x=0, y=0)

b.mainloop()
Enter fullscreen mode Exit fullscreen mode

4.Entry(Text input box)

from tkinter import *

b = Tk()

e1 = Entry(b, font=("arial",14), fg="black", bd=5, relief=RIDGE)
e1.place(x=0, y=0)

b.mainloop()
Enter fullscreen mode Exit fullscreen mode

5.Text box(Multi-line input box)

from tkinter import *

b = Tk()

t1 = Text(b, font=("arial",14), height=30, width=30)
t1.place(x=0, y=0)

b.mainloop()
Enter fullscreen mode Exit fullscreen mode

This guide covered the basics of tkinter GUI development, including creating window and adding more widget and customize their styles. If you have any questions about GUI development, leave a comment below.

Few codes are in github. Github

Top comments (0)