WEBLEB
Início
Editor
Entrar
Pro
Português
English
Français
Español
Português
Deutsch
Italiano
हिंदी
seg
62
mironovbogdan341
Abrir no Editor
Publique Seu Código
Recomendado
27 March 2025
Segurança APT
3 October 2024
segurança
HTML
Copy
CSS
Copy
<!-- Replace with your CSS Code (Leave empty if not needed) -->
JS
Copy
import tkinter as tk # Function to change the background color based on RGB values def change_color(r, g, b): color = f'#{r:02x}{g:02x}{b:02x}' # Convert RGB to hex root.config(bg=color) # Change the background color # Create the main window root = tk.Tk() root.title('RGB Background Color') root.geometry('300x200') root.config(bg='black') # Set initial background to black # Create a button to change the color button = tk.Button(root, text='Change Color', command=lambda: change_color(255, 0, 0)) # Change to red button.pack(pady=20) # Start the GUI event loop root.mainloop()