[wxPython-users] Horz ALigned Label in Toolbar Button
Robin Dunn
robin at alldunn.com
Sat Nov 25 14:21:17 PST 2006
Greg wrote:
> Hello everyone. Maybe you guys can help me out.
>
> I'm trying to get a text label displayed to the right of a toolbar button. I
> attached some sample code below. Here's a screenshot of what I get - no label:
> http://img179.imageshack.us/img179/9432/tbexamplelo8.png
>
> I'm hovering my mouse over the icon, but for some reason the pointer didn't get
> grabbed in the screenshot, but the tool tip did. If you look at the screenshot
> you'll that there's some extra space to the right of the icon. It's like
> wxPython *really* wants to put a label there, but it's too tired.
>
>
> WinXP SP2, Python2.5, wxPython 2.7.2.0
>
> import wx
>
> app = wx.PySimpleApp()
> frame = wx.Frame(None, -1, "Toolbar Example")
>
> tb = frame.CreateToolBar(wx.TB_HORZ_LAYOUT|wx.TB_TEXT)
> img = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, (15, 15))
> tb.AddSimpleTool(-1, img, "Test", "This is a test.")
The label is not the same as the shortHelp or longHelp parameters. You
need to use a different method that allows you to include the label,
such as AddLabelTool.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list