Answers for "making buttons tkinter"

4

how to add button in tkinter

from tkinter import *
window = Tk()

def got_clicked():
  print("I got clicked!")

my_button = Button(text="Click me", command=got_clicked)
my_button.pack()

window.mainloop()
Posted by: Guest on February-01-2021
5

how to make custom buttons tkinter

from tkinter import *

root = Tk()

button = Button(root, text="Click me!")
img = PhotoImage(file="C:/path to image/example.gif") # make sure to add "/" not "\"
button.config(image=img)
button.pack() # Displaying the button

root.mainloop()
Posted by: Guest on July-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language