WEBLEB
Accueil
Éditeur
Connexion
Pro
Français
English
Français
Español
Português
Deutsch
Italiano
हिंदी
Lun
61
mironovbogdan341
Ouvrir dans l'éditeur
Publiez votre code
24 February 2025
La radio est tellement lunatique ✅
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()