wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.29k stars 516 forks source link

MSW toolbar doesn't use native toolbar background #964

Open v-rob opened 6 years ago

v-rob commented 6 years ago

Operating system: Windows 7 Ultimate 64-bit wxPython version: 4.0.3, stock, installed with pip Python version: 3.7.0, stock

Description of the problem: Under Windows 7, the native toolbar background should be a silver gradient similar to the menu bar, but when I make a toolbar, it appears flat.

This is an image of the result:

toolbar_test

Instead, it should appear like this (not my own picture):

toolbar_test

The code I used is as follows (the menubar exists for comparison):

import wx

root = wx.App()

window = wx.Frame(None, title = "Toolbar Test")

menubar = wx.MenuBar()
filemenu = wx.Menu()
fileitem = filemenu.Append(wx.ID_EXIT, 'Quit')
menubar.Append(filemenu, '&File')
window.SetMenuBar(menubar)
window.Bind(wx.EVT_MENU, lambda x: window.Close(), fileitem)

toolbar = window.CreateToolBar()
tool = toolbar.AddTool(wx.ID_ANY, label = 'Tool', bitmap = wx.Bitmap('save.png'))
toolbar.Realize()

window.SetSize(300, 200)
window.Centre()
window.Show()

root.MainLoop()

If I use wx.ToolBar(window) instead of window.CreateToolBar(), it still appears flat. Styles do not affect the flat look in either of the methods.

RobinD42 commented 5 years ago

The wxWidgets Toolbar sample behaves the same, so this isn't wxPython specific. It may be that wxWidgets is using a different native toolbar widget than the one in the other screenshot, or perhaps using non-default options, in order to be able provide all the features of the wxToolbar.

Creating a ticket about this (if there isn't already one there) at https://trac.wxwidgets.org/ might shed some more light on this. Please reply here with the link to the ticket for tracking purposes.