Tkinter

what is tkinter in python?

Last updated:6/27/2018 3:41:01 AM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

- Tkinter is a lib for designing GUI in python.

- Import the Tkinter module. Create the GUI application in main window. 

- Add one or more of the above-mentioned widgets to the GUI application.

Syntax :

import tkinter 
top = tkinter.Tk()
top.mainloop()

Example for adding any text with a button :

from tkinter import* 
from tkinter ttk
root = Tk()
label (root,text='Hello!').pack()
button= ttk.Button(root,text='click me')
button.pack()
def callback():
 print('clicked!')
root.main loop()


Answer