toolbar add separator problem

i have a toolbar init:

        self.toolbar.SetToolBitmapSize((48, 48))

        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowRight.png'))
        self.toolbar.AddSeparator()
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowLeft.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/clock.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/workingSheet.png'))
        self.toolbar.Realize()

but the separator does not show, where ever i put it. any hints?
thanks in advance!

regards,

···

--
Dejan

dejan todorović wrote:

i have a toolbar init:

        self.toolbar.SetToolBitmapSize((48, 48))

        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowRight.png'))
        self.toolbar.AddSeparator()
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowLeft.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/clock.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/workingSheet.png'))
        self.toolbar.Realize()

but the separator does not show, where ever i put it. any hints?
thanks in advance!

regards,
  
I don't see anything obviously wrong...except that you don't have a call to CreateToolBar() above. That would do it.

Here's a quick demo that works for me:

<code>

import wx

class MyForm(wx.Frame):

def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "wx.Toolbar Demo")
panel = wx.Panel(self, wx.ID_ANY)

self.createToolbar()

def createToolbar(self):
"""
Create a toolbar.
"""

self.toolbar = self.CreateToolBar()
self.toolbar.SetToolBitmapSize((16,16)) # sets icon size

# Use wx.ArtProvider for default icons
save_ico = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, (16,16))
saveTool = self.toolbar.AddSimpleTool(wx.ID_ANY, save_ico, "Save", "Saves the Current Worksheet")

self.toolbar.AddSeparator()

print_ico = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR, (16,16))
printTool = self.toolbar.AddSimpleTool(wx.ID_ANY, print_ico, "Print", "Sends Timesheet to Default Printer")

# This basically shows the toolbar
self.toolbar.Realize()

# Run the program
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyForm().Show()
app.MainLoop()

</code>

I'm on Windows XP with wxPython 2.8.9.1 and Python 2.5.2. What are you using?

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

if i create toolbar like this:

self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_TEXT)

separator line vanish. Creating toolbar without any properties shows
the separator line.

hm?

···

On Wed, Feb 18, 2009 at 5:38 PM, Mike Driscoll <mike@pythonlibrary.org> wrote:

dejan todorović wrote:

i have a toolbar init:

       self.toolbar.SetToolBitmapSize((48, 48))

       self.toolbar.AddLabelTool(-1, '',
wx.Bitmap('../img/arrowRight.png'))
       self.toolbar.AddSeparator()
       self.toolbar.AddLabelTool(-1, '',
wx.Bitmap('../img/arrowLeft.png'))
       self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/clock.png'))
       self.toolbar.AddLabelTool(-1, '',
wx.Bitmap('../img/workingSheet.png'))
       self.toolbar.Realize()

but the separator does not show, where ever i put it. any hints?
thanks in advance!

regards,

I don't see anything obviously wrong...except that you don't have a call to
CreateToolBar() above. That would do it.

Here's a quick demo that works for me:

<code>

import wx

class MyForm(wx.Frame):

def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "wx.Toolbar Demo")
panel = wx.Panel(self, wx.ID_ANY)

self.createToolbar()

def createToolbar(self):
"""
Create a toolbar.
"""

self.toolbar = self.CreateToolBar()
self.toolbar.SetToolBitmapSize((16,16)) # sets icon size

# Use wx.ArtProvider for default icons
save_ico = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR,
(16,16))
saveTool = self.toolbar.AddSimpleTool(wx.ID_ANY, save_ico, "Save", "Saves
the Current Worksheet")

self.toolbar.AddSeparator()

print_ico = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR, (16,16))
printTool = self.toolbar.AddSimpleTool(wx.ID_ANY, print_ico, "Print", "Sends
Timesheet to Default Printer")

# This basically shows the toolbar
self.toolbar.Realize()

# Run the program
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyForm().Show()
app.MainLoop()

</code>

I'm on Windows XP with wxPython 2.8.9.1 and Python 2.5.2. What are you
using?

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
Dejan

dejan todorović wrote:

i have a toolbar init:

        self.toolbar.SetToolBitmapSize((48, 48))

        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowRight.png'))
        self.toolbar.AddSeparator()
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/arrowLeft.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/clock.png'))
        self.toolbar.AddLabelTool(-1, '', wx.Bitmap('../img/workingSheet.png'))
        self.toolbar.Realize()

but the separator does not show, where ever i put it. any hints?
thanks in advance!

What platform? In some cases the separator is just a bit of empty space, not an actual line. It may also depend on other styles and whether theming is used or not and if the current theme draws separators as lines.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

It is windows xp, python 2.5.2 and the latest wxpython.
I have tried Mike's example and the separator lines are showing, but
if you provide parameters to CreateToolBar,

self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_TEXT)

separators disappear.

···

--
Dejan