Reputation: 23
So i made this program for fun but i saw that when i click the button the "ez" text appears in pycharm and i wanted to make it appear in the window of the program. Does anyone know how i can do that?
import tkinter as tk
import os
def click():
print('ez')
os.system("shutdown /s /t 3")
window = tk.Tk()
window.geometry("420x420")
window.title("Russian Roulette!")
window.config(background = "#000000")
label = tk.Label(window,
text = "Are you sure you want to boost your FPS?",
font = ('Aerial', 20, 'bold'),
fg = 'green',
bg = '#000000',
)
label.place(x = 50 , y = 50)
button = tk.Button(window,
text = "Boost FPS!",
command = click,
font = ('Aerial', 20, 'bold'),
fg = 'green',
bg = '#000000',
activeforeground = 'green',
activebackground = '#000000',
relief = tk.RAISED, bd = 10, padx = 5, pady = 5,
)
button.place(x = 50, y = 150)
button = tk.Button(window,
text = "Cancel",
command = click,
font = ('Aerial', 20, 'bold'),
fg = 'green',
bg = '#000000',
activeforeground = 'green',
activebackground = '#000000',
relief = tk.RAISED, bd = 10, padx = 5, pady = 5,
)
button.place(x = 470, y = 150)
window.mainloop()
Upvotes: 1
Views: 125
Reputation: 5982
Just set the new text to the label you already have:
def click():
label.config(text="ez")
os.system("shutdown /s /t 3")
Upvotes: 2