-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Background color for titlebar and menubar #961
Comments
Is it even possible to change title screen to another color? |
You cannot change the titlebar color. You can, however, remove the title bar and draw your own. You will have to implement all the buttons yourself. I'm checking to see how to change the menubar colors. |
Not a good sign for menu bar colors. I checked for tkinter, Qt and WxPython. Everyone says that is can't be done unless you make windows systems calls. Here's one attempt using WxPython You could potentially make a series of ButtonMenus across the top, but I've only implemented those on PySimpleGUIQt so far. They won't behave exactly like normal menus however. I'm kinda shocked that I'm unable to create windows that have a particular color for all parts of the window. That tells me that applications that do this are working at a very low level within Windows or Linux, perhaps making Windows system calls directly. Really sorry about this. I'll see how it looks to make several ButtonMenus across the top. |
Whew! Done! ButtonMenus for tkinter is done and checked into Master Branch. This menu was created using this code: import PySimpleGUI as sg
# import PySimpleGUIQt as sg
sg.ChangeLookAndFeel('Black')
menu_def = ['&File', ['&Open', '!&Save', 'E&xit', 'Properties']]
edit_def = ['Edit', ['&Edit', '&Menu', 'Items', 'Properties']]
layout = [
[sg.ButtonMenu('File', menu_def, button_color=('white', 'black'), key='_FILE_'),
sg.ButtonMenu('Edit', menu_def, button_color=('white', 'black'), key='_EDIT_'),
sg.Stretch()],
[sg.Text('Your typed chars appear here:'), sg.Text('', key='_OUTPUT_')],
[sg.Input(do_not_clear=True, key='_IN_')],
[sg.Button('Show'), sg.Button('Exit')]
]
window = sg.Window('Window Title',
no_titlebar=True,
border_depth=0,
grab_anywhere=True,
).Layout(layout)
while True: # Event Loop
event, values = window.Read()
if event in (None, 'Exit'):
break
print(event, values)
if event == '_FILE_': # if a File menu item chosen
if values[event] == 'Exit': # test which item chosen
break
if event == 'Show':
window.Element('_EDIT_').Update(edit_def) # change the edit menu definition
window.Close() They work exactly the same way as PySimpleGUIQt ButtonMenus work. If you change the import statement at the top to Qt, the code works in an identical manner. Hopefully this gets you closer to what you're looking for. At least you can now have cascading menus that match your background color. While you cannot use shortcut keys to access the top-level menu buttons, you can use shortcuts once the menu is open. I'm glad to have this one now off the list. |
You are an angle <3
Op vr 21 dec. 2018 17:09 schreef MikeTheWatchGuy <notifications@github.com:
… Whew! Done!
ButtonMenus for tkinter is done and checked into Master Branch.
[image: buttonmenu]
<https://user-images.githubusercontent.com/13696193/50351561-95a8e400-0510-11e9-9e9e-0cbc30fe3c06.gif>
This menu was created using this code:
import PySimpleGUI as sg# import PySimpleGUIQt as sg
sg.ChangeLookAndFeel('Black')
menu_def = ['&File', ['&Open', '!&Save', 'E&xit', 'Properties']]
edit_def = ['Edit', ['&Edit', '&Menu', 'Items', 'Properties']]
layout = [
[sg.ButtonMenu('File', menu_def, button_color=('white', 'black'), key='_FILE_'),
sg.ButtonMenu('Edit', menu_def, button_color=('white', 'black'), key='_EDIT_'),
sg.Stretch()],
[sg.Text('Your typed chars appear here:'), sg.Text('', key='_OUTPUT_')],
[sg.Input(do_not_clear=True, key='_IN_')],
[sg.Button('Show'), sg.Button('Exit')]
]
window = sg.Window('Window Title',
no_titlebar=True,
border_depth=0,
grab_anywhere=True,
).Layout(layout)
while True: # Event Loop
event, values = window.Read()
if event in (None, 'Exit'):
break
print(event, values)
if event == '_FILE_': # if a File menu item chosen
if values[event] == 'Exit': # test which item chosen
break
if event == 'Show':
window.Element('_EDIT_').Update(edit_def) # change the edit menu definition
window.Close()
They work exactly the same way as PySimpleGUIQt ButtonMenus work.
If you change the import statement at the top to Qt, the code works in an
identical manner.
Hopefully this gets you closer to what you're looking for. At least you
can now have cascading menus that match your background color.
While you cannot use shortcut keys to access the top-level menu buttons,
you can use shortcuts once the menu is open.
I'm glad to have this one now off the list.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#961 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AqiZ00NdP5HuCgZxOrb6---L3ZRLTq5Cks5u7QfUgaJpZM4Zdw4V>
.
|
I think this one is done. Will release to PyPI soonish. |
Is it possible to change the pop-uped menu_def's background color? means when clicked 'File' or 'Edit' small popup window... |
There's no option for color of import PySimpleGUI as sg
sg.ChangeLookAndFeel('DarkGrey')
menu_def = ['&File', ['&Open', '!&Save', 'E&xit', 'Properties']]
edit_def = ['Edit', ['&Edit', '&Menu', 'Items', 'Properties']]
layout = [
[sg.ButtonMenu('File', menu_def, key='_FILE_'),
sg.ButtonMenu('Edit', edit_def, key='_EDIT_'),
sg.Stretch()],
[sg.Multiline("", size=(50, 5))],
[sg.Button('Exit')],
]
window = sg.Window('Window Title', layout, no_titlebar=True, border_depth=0,
grab_anywhere=True, finalize=True)
# Set color here for Menu, not ButtonMenu.
window['_FILE_'].TKMenu.configure(fg='white', bg='blue')
while True:
event, values = window.read()
if event in (sg.WINDOW_CLOSED, 'Exit'):
break
window.Close() |
I think this can be closed. Menu and ButtonMenu color capabilities were released to PyPI in 4.31.0 |
The text was updated successfully, but these errors were encountered: