DEV Community

Cover image for Creating button with Python.
AlixaProDev
AlixaProDev

Posted on

Creating button with Python.

Tkinter gives us classes to create different widgets, and so is the case with a button. We have a BUtton class in tkk. which gives us the ability to create a button with the help of the Tkinter library.

Below is the code that helps us create a simple button.

from tkinter import Tk
from tkinter import ttk
root = Tk()
button = ttk.Button(root,text="AlixaProDev")
button.grid()
root.mainloop()
Enter fullscreen mode Exit fullscreen mode

You can learn more about creating button with Tkinter in Python from my blog.

Top comments (0)