Answers for "how to create a button using tkinter"

0

how to create a button using tkinter

import tkinter as tk
window = tk.Tk()

button=tk.Button(window, text="CLICK ME: ", command=testCommand) 
"""creates the button and sets the location, text and what command to run once clicked"""


button.pack()
""" this loads the button in to the program.
you can use button.grid(row=1, column=1) as a another option to load this but both
cannot be used in a program together"""
window.mainloop()
Posted by: Guest on April-18-2022

Code answers related to "how to create a button using tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language