Python, графический интерфейс: измените цвет верхней панели меню приложения

#python #guizero

#python #guizero

Вопрос:

Я довольно новичок в python amp; coding, и в настоящее время я экспериментирую с guizero, чтобы создать несколько базовых панелей мониторинга. Мой вопрос: как мне изменить верхнюю строку меню приложения в guizero? Возможно ли это вообще?

Заранее благодарю вас.

Мой код:

 from guizero import App, PushButton, Text, Box

def dashboard():
# Dashboard settings
dashboard = App(title="Dashboard", width=320, height=320)
dashboard.bg = grey


# Title amp; title box
title_box = Box(dashboard, align="top", border=True)
title = Text(title_box, text="Dashboard", size=30)
title.text_color = orange

# Led status display
status_box = Box(dashboard, align="top", border=True)
status1 = Text(status_box, align="left", text="Status Led 1")
status1.bg = white
status1.size = 15

status_box1 = Box(dashboard, align="top", border=True)
status2 = Text(status_box1, text="Status Led 2")
status2.bg = white
status2.size = 15

status_box2 = Box(dashboard,align="top", border=True)
status3 = Text(status_box2, text="Status Led 3")
status3.bg = white
status3.size = 15

# Status Pushbuttons
status_pushbutton = Box(dashboard,align="bottom", border=True)
status_button = Text(status_pushbutton, text="Status Pushbutton 3")
status_button.bg = white
status_button.size = 15

status_pushbutton1 = Box(dashboard, align="bottom", border=True)
status_button1 = Text(status_pushbutton1, text="Status Pushbutton 2")
status_button1.bg = white
status_button1.size = 15

status_pushbutton2 = Box(dashboard, align="bottom", border=True)
status_button2 = Text(status_pushbutton2, text="Status Pushbutton 1")
status_button2.bg = white
status_button2.size = 15

dashboard.display()
 

Ответ №1:

У вас даже нет строки меню, так что вы имеете в виду? P.s Вы не должны помещать ‘dashboard = App’ внутри функции. Вы также не добавили никаких » ‘ или » » вокруг названий цветов.