Ответ на от p3_181027_2114.py

from tkinter import *
root = Tk()
root.title("backgroundcolor")
 
b1 = Button(text = "", activebackground = "#FFDB00", justify = CENTER, width = 200, height = 2)
b2 = Button(text = "", activebackground = "#0048BA", justify = CENTER, width = 200, height = 2)
b3 = Button(text = "", activebackground = "#FF0800", justify = CENTER, width = 200, height = 2)
b4 = Button(text = "", activebackground = "#F400A1", justify = CENTER, width = 200, height = 2)
b5 = Button(text = "", activebackground = "#00FF00", justify = CENTER, width = 200, height = 2)
b6 = Button(text = "", activebackground = "#6C5D53", justify = CENTER, width = 200, height = 2)
b7 = Button(text = "", activebackground = "#FFFFFF", justify = CENTER, width = 200, height = 2)
 
 
def yellow():
    b1["text"] = "#FFDB00"
 
def blue():
    b2["text"] = "#0048BA"
 
def red():
    b3["text"] = "#FF0800"
 
def purple():
    b4["text"] = "#F400A1"
 
def green():
    b5["text"] = "#00FF00"
 
def brown():
    b6["text"] = "#6C5D53"
 
def white():
    b7["text"] = "#FFFFFF"
 
 
b1.config(command = yellow, bg = "#FFDB00")
b2.config(command = blue, bg = "#0048BA")
b3.config(command = red, bg = "#FF0800")
b4.config(command = purple, bg = "#F400A1")
b5.config(command = green, bg = "#00FF00")
b6.config(command = brown, bg = "#6C5D53")
b7.config(command = white, bg = "#FFFFFF")
 
b1.pack()
b2.pack()
b3.pack()
b4.pack()
b5.pack()
b6.pack()
b7.pack()
 
root.mainloop()

Ограниченный HTML

  • Допустимые HTML-теги: <p> <br> <em> <strong> <ul> <ol> <li> <pre> <code>
  • Для синтаксической подсветки исходного кода следует использовать теги: <pre>, <code>, <bash>, <c>, <java>, <pycon>, <python>.
CAPTCHA
Этот вопрос задается для того, чтобы выяснить, являетесь ли Вы человеком или представляете из себя автоматическую спам-рассылку.