Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #create #button #tkinter
ADD COMMENT
Topic
Name
6+8 =