+ 2
How do you create an input method by pressing a button in python
2 Answers
+ 8
#Button value increases when you click
#Is this what you want?
import tkinter as tk
win = tk.Tk()
win.geometry('600x600')
def click():
num = int(btn['text'])
btn.config(text = str(num + 1))
btn = tk.Button(text = '0', command = click)
btn.pack(fill = tk.BOTH, expand = tk.YES)
win.mainloop()
+ 3
tKinter only works in the IDLE but not in the code playground.
You have import the tKinter module in IDLE by the command
#######
import tkinter