开发者

How to remove the 1px border under a toolbar?

I have a toolbar, which is next to a slider (screenshot: h开发者_JAVA百科ttp://i54.tinypic.com/w2n6ag.jpg) and wxPython automatically puts a tiny 1px border under the [Play/Pause/Stop | Previous/Next] buttons.

This does not look nice at all so is it possible to remove it/set it to 0px? Thank you very much.

Here is part of the my code

    toolbar = wx.ToolBar(self, wx.ID_ANY, style=wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
    toolbar.SetToolBitmapSize((24, 24))

    toolbar.AddRadioLabelTool(wx.ID_ANY, '', wx.Bitmap('icons/buttons/control_play.png'), shortHelp='Play', longHelp='')
    toolbar.AddRadioLabelTool(wx.ID_ANY, '', wx.Bitmap('icons/buttons/control_pause.png'), shortHelp='Pause', longHelp='')
    toolbar.AddRadioLabelTool(wx.ID_ANY, '', wx.Bitmap('icons/buttons/control_stop.png'), shortHelp='Stop', longHelp='')
    toolbar.AddSeparator()
    toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('icons/buttons/frame_previous.png'), shortHelp='Previous', longHelp='')
    toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('icons/buttons/frame_next.png'), shortHelp='Next', longHelp='')


    toolbar.Realize()

p/s: vertical toolbar (i.e. wx.TB_VERTICAL) does not have this bottom border so a temporary solution is to have 5 vertical toolbars next to each other (each has one button), but I guess there maybe another solution for this?


Just in case anyone else stumbles their way here looking to fix the same problem: try adding wx.TB_NODIVIDER to your style, e.g.

style=wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT | wx.TB_NODIVIDER

Removed the ugly line for me in XP at any rate.


I didn't know toolbars added lines. It must be platform specific and if so, then that's normal. The easiest way I can think of to workaround this is to just us a horizontal BoxSizer and put all your widgets in that instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜