DEV Community

Blackmare01wolf
Blackmare01wolf

Posted on

2

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.

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

👋 Kindness is contagious

Please consider leaving a ❤️ or a kind comment on this post if it was useful to you!

Thanks!