Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3996864
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:19:52+00:00 2026-05-20T07:19:52+00:00

The wxPython ToolBar look and feel does not match that of the current operating

  • 0

The wxPython ToolBar look and feel does not match that of the current operating system – it has a gradient similar to the Windows Vista / 7 menubar I.E. a silver gradient.

Is there any way to change this so that it blends in with the operating systems look and feel?

Note: There is a style flag that can be set when creating the ToolBar and one of those flags is wx.TB_FLAT but this seems to have no affect on the way the ToolBar is rendered.

I am running my wxPython program on Windows 7.

Edit: Below is a screen shot of what I am seeing.

alt text

Edit: It seems the toolbar is drawn in accordance with the current theme as changing to the Windows Classic theme renders a flat toolbar which matches the window background.

The code below shows what I have tried so far. I have created a method called OnPaint which is bound to the toolbars paint event. This has no effect and the toolbar is drawn as in the image above.

I know that the code in OnPaint works as the rectangle is rendered if i bind this method to the windows paint event instead of the toolbars.

import wx

ID_STAT = 1
ID_TOOL = 2

class CheckMenuItem(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(350, 250))

        menubar = wx.MenuBar()
        file = wx.Menu()
        view = wx.Menu()
        self.shst = view.Append(ID_STAT, 'Show statubar', 'Show Statusbar', kind=wx.ITEM_CHECK)
        self.shtl = view.Append(ID_TOOL, 'Show toolbar', 'Show Toolbar', kind=wx.ITEM_CHECK)
        view.Check(ID_STAT, True)
        view.Check(ID_TOOL, True)

        self.Bind(wx.EVT_MENU, self.ToggleStatusBar, id=ID_STAT)
        self.Bind(wx.EVT_MENU, self.ToggleToolBar, id=ID_TOOL)

        menubar.Append(file, '&File')
        menubar.Append(view, '&View')
        self.SetMenuBar(menubar)

        self.toolbar = self.CreateToolBar()
        self.toolbar.Realize()

        self.statusbar = self.CreateStatusBar()

        self.Bind(wx.EVT_PAINT, self.OnPaint, self.toolbar)

        self.Centre()
        self.Show(True)

    def OnPaint(self, e):
        dc = wx.PaintDC(self)
        dc.SetBrush(wx.Brush('#c56c00'))
        dc.DrawRectangle(10, 15, 90, 60)

    def ToggleStatusBar(self, event):
        if self.shst.IsChecked():
            self.statusbar.Show()
        else:
            self.statusbar.Hide()

    def ToggleToolBar(self, event):
        if self.shtl.IsChecked():
            self.toolbar.Show()
        else:
            self.toolbar.Hide()

app = wx.App()
CheckMenuItem(None, -1, 'Toolbar Test')
app.MainLoop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:19:53+00:00Added an answer on May 20, 2026 at 7:19 am

    It seems the solution to my problem is actually quite simple. Instead of trying to apply some custom paint logic all that was required was a call to the toolbars SetBackgroundColour() method.

    The system look and feel can be maintained by using the colours from the wx.SystemSettings class.

    self.toolbar.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUBAR))
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that wxToolBar is not behaving like native OSX apps does. wxToolbar http://img15.imageshack.us/img15/5683/screenshot20091208at947.png
I have a wxPython application that relies on an external config file. I want
I have wxPython app which is running on MS Windows and I'd like it
I've developed a program that extensively uses wxPython - the wxWindow port for python.
I have a little logging app (written in wxPython) that receives data from a
I'm working on a GUI application in WxPython, and I am not sure how
I'm making a toolbar using wxpython and I want to put the Quit button
in wxpython, is there a event that can occur when one of the function
I have a wxpython app designed using XRC which has a multiline textctrl inside
I have wxpython application that run over a list of files on some directory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.