From 830ed2a526f68460b3c24638825a1ec03c83dd92 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Tue, 24 Sep 2019 17:01:35 -0400 Subject: [PATCH] Implemented background color for Menus --- PySimpleGUIQt/PySimpleGUIQt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index 2bebd56d..32858383 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "0.29.0.2 Unreleased" +version = __version__ = "0.29.0.3 Unreleased Menu color" import sys import types @@ -5272,6 +5272,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win): qt_row_layout.addWidget(element.QT_QGraphicsView) # ------------------------- MENUBAR element ------------------------- # elif element_type == ELEM_TYPE_MENUBAR: + element = element # type: Menu menu_def = element.MenuDefinition element.Widget = element.QT_QMenuBar = QMenuBar(toplevel_win.QT_QMainWindow) @@ -5285,6 +5286,10 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win): baritem.setTitle(menu_entry[0]) element.QT_QMenuBar.addAction(baritem.menuAction()) AddMenuItem(baritem, menu_entry[1], element) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT: + style = Style('QMenuBar') + style.add(background_color=(element.BackgroundColor)) + element.QT_QMenuBar.setStyleSheet(style.content) if not element.Visible: element.QT_QMenuBar.setVisible(False) toplevel_win.QT_QMainWindow.setMenuBar(element.QT_QMenuBar)