Answers for "give utton a number python"

1

how to make a button in python

import tkinter as tk
    

def write_slogan():
    print("Tkinter is easy to use!")

root = tk.Tk()
frame = tk.Frame(root)
frame.pack()

button = tk.Button(frame, 
                   text="QUIT", 
                   fg="red",
                   command=quit)
button.pack(side=tk.LEFT)
slogan = tk.Button(frame,
                   text="Hello",
                   command=write_slogan)
slogan.pack(side=tk.LEFT)

root.mainloop()
Posted by: Guest on September-02-2020
0

give utton a number python

def create_buttons(self):
    for x in range(10):
        button = ttk.Button(self, text=x, command=lambda number=x: self.callback(number))
        button.grid()
Posted by: Guest on January-11-2021
0

give utton a number python

def callback(self, number):
    new_value = self.user_input.get() + str(number)
    self.user_input.set(new_value)
Posted by: Guest on January-11-2021

Code answers related to "give utton a number python"

Python Answers by Framework

Browse Popular Code Answers by Language