WEBLEB
होम
संपादक
लॉग इन करें
Pro
हिंदी
English
Français
Español
Português
Deutsch
Italiano
हिंदी
सोमवार
163
mironovbogdan341
संपादक में खोलें
अपना कोड प्रकाशित करें
क्या आपको एक वेबसाइट चाहिए?
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()