Answers for "creating a button in tkinter"

2

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
4

python button tkinter

from tkinter import *

wow = Tk()

def ree(hi):
  print(hi)
  
w = Button ( master=wow, command=ree('hi'), text="hi" )

Output:
  Tkinter:
    ______
   [  hi  ] <--- Button
    ------
  
  Shell:
    hi <--- on button pressed
Posted by: Guest on March-20-2020
1

add a button on tkinter

import tkinter
button1 = ttk.Button(self, text="anything", command=random command)
        button1.pack()
Posted by: Guest on March-23-2020

Python Answers by Framework

Browse Popular Code Answers by Language