wx.toolbar on top

Hi,

I am writing an applications that has a dockable toolbar with
(wx.TB_DOCKABLE). The problem is when I move the toolbar (floating
now) it disappears behind the window when the focus is on the window.

The isolated code is here (you need up.png and down.png):

import wx

class VerticalToolbar(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(240, 300))

        toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE)
        toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('up.png'))
        toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('down.png'))
        toolbar.Realize()

        self.Centre()
        self.Show(True)

    def OnExit(self, event):
        self.Close()

app = wx.App()
VerticalToolbar(None, -1, 'vertical toolbar')
app.MainLoop()

Regards,
Miro

I think give your Frame the style flag style=wx.STAY_ON_TOP.

Che

···

On Sat, Aug 22, 2009 at 8:23 AM, miro.kubiczek miroslav.kubiczek@gmail.com wrote:

Hi,

I am writing an applications that has a dockable toolbar with

(wx.TB_DOCKABLE). The problem is when I move the toolbar (floating

now) it disappears behind the window when the focus is on the window.

The isolated code is here (you need up.png and down.png):

import wx

class VerticalToolbar(wx.Frame):

def __init__(self, parent, id, title):

    wx.Frame.__init__(self, parent, id, title, size=(240, 300))



    toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE)

    toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('up.png'))

    toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('down.png'))

    toolbar.Realize()



    self.Centre()

    self.Show(True)



def OnExit(self, event):

    self.Close()

app = wx.App()

VerticalToolbar(None, -1, ‘vertical toolbar’)

app.MainLoop()

> Hi,

> I am writing an applications that has a dockable toolbar with
> (wx.TB_DOCKABLE). The problem is when I move the toolbar (floating
> now) it disappears behind the window when the focus is on the window.

> The isolated code is here (you need up.png and down.png):

> import wx

> class VerticalToolbar(wx.Frame):
> def __init__(self, parent, id, title):
> wx.Frame.__init__(self, parent, id, title, size=(240, 300))

> toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE)
> toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('up.png'))
> toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('down.png'))
> toolbar.Realize()

> self.Centre()
> self.Show(True)

> def OnExit(self, event):
> self.Close()

> app = wx.App()
> VerticalToolbar(None, -1, 'vertical toolbar')
> app.MainLoop()

I think give your Frame the style flag style=wx.STAY_ON_TOP.

Che

Thanks for the hint but this even worse the thing. The frame on top
redraws the toolbar so it's invisible when located in the Frame area.
I also tried using wx.STAY_ON_TOP but it has not any effect.
I am doing all this in xfce4 in xubuntu.

> Hi,

> I am writing an applications that has a dockable toolbar with
> (wx.TB_DOCKABLE). The problem is when I move the toolbar (floating
> now) it disappears behind the window when the focus is on the window.

> The isolated code is here (you need up.png and down.png):

> import wx

> class VerticalToolbar(wx.Frame):
> def __init__(self, parent, id, title):
> wx.Frame.__init__(self, parent, id, title, size=(240, 300))

> toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE)
> toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('up.png'))
> toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('down.png'))
> toolbar.Realize()

> self.Centre()
> self.Show(True)

> def OnExit(self, event):
> self.Close()

> app = wx.App()
> VerticalToolbar(None, -1, 'vertical toolbar')
> app.MainLoop()

I think give your Frame the style flag style=wx.STAY_ON_TOP.

Che

Thanks for the hint but this even worse the thing. The frame on top
redraws the toolbar so it's invisible when located in the Frame area.
I also tried using wx.STAY_ON_TOP but it has not any effect.
I am doing all this in xfce4 in xubuntu.

Sorry, correction of 3rd sentence: I also tried using wx.STAY_ON_TOP
when creating the toolbar but it didn't have any effect.

Weird...that should work. What python and wxPython versions are you
using? Can you provide a small runnable example? See
http://wiki.wxpython.org/MakingSampleApps

- Mike

···

On Aug 22, 3:59 pm, Miroslav Kubiczek <miroslav.kubic...@gmail.com> wrote:

>> > Hi,

>> > I am writing an applications that has a dockable toolbar with
>> > (wx.TB_DOCKABLE). The problem is when I move the toolbar (floating
>> > now) it disappears behind the window when the focus is on the window.

>> > The isolated code is here (you need up.png and down.png):

>> > import wx

>> > class VerticalToolbar(wx.Frame):
>> > def __init__(self, parent, id, title):
>> > wx.Frame.__init__(self, parent, id, title, size=(240, 300))

>> > toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE)
>> > toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('up.png'))
>> > toolbar.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('down.png'))
>> > toolbar.Realize()

>> > self.Centre()
>> > self.Show(True)

>> > def OnExit(self, event):
>> > self.Close()

>> > app = wx.App()
>> > VerticalToolbar(None, -1, 'vertical toolbar')
>> > app.MainLoop()

>> I think give your Frame the style flag style=wx.STAY_ON_TOP.

>> Che

> Thanks for the hint but this even worse the thing. The frame on top
> redraws the toolbar so it's invisible when located in the Frame area.
> I also tried using wx.STAY_ON_TOP but it has not any effect.
> I am doing all this in xfce4 in xubuntu.

Sorry, correction of 3rd sentence: I also tried using wx.STAY_ON_TOP
when creating the toolbar but it didn't have any effect.

Weird...that should work. What python and wxPython versions are you
using? Can you provide a small runnable example? Seehttp://wiki.wxpython.org/MakingSampleApps

- Mike

wxpython: 2.8.9.1 (gtk2-unicode)
Python: 2.6.2

Working example:

import wx

class VerticalToolbar(wx.Frame):
   def __init__(self, parent, id, title):
       wx.Frame.__init__(self, parent, id, title, size=(240, 300),
style=wx.STAY_ON_TOP)

       tsize=(24,24)
       toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE )
       toolbar.AddLabelTool(wx.ID_ANY, '', wx.ArtProvider.GetBitmap
(wx.ART_NEW, wx.ART_TOOLBAR, tsize))
       toolbar.AddLabelTool(wx.ID_ANY, '', wx.ArtProvider.GetBitmap
(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize))
       toolbar.Realize()

       self.Centre()
       self.Show(True)

app = wx.App()
VerticalToolbar(None, -1, 'vertical toolbar')
app.MainLoop()

Yes, I just confirmed that this works pretty well on XP (especially if I make
the frame size = the toolbar size) but doesn’t work at all on Linux. XP I can’t
drag the toolbar to freely float, but on Linux I can, but then the frame is just

sitting there staying on top, as Miro said. Not sure what to recommend.

Che

···

On Mon, Aug 24, 2009 at 4:48 PM, miro.kubiczek miroslav.kubiczek@gmail.com wrote:

Weird…that should work. What python and wxPython versions are you

using? Can you provide a small runnable example? Seehttp://wiki.wxpython.org/MakingSampleApps

  • Mike

wxpython: 2.8.9.1 (gtk2-unicode)

Python: 2.6.2

Working example:

import wx

class VerticalToolbar(wx.Frame):

def init(self, parent, id, title):

wx.Frame.init(self, parent, id, title, size=(240, 300),

style=wx.STAY_ON_TOP)

   tsize=(24,24)

toolbar = self.CreateToolBar(wx.TB_VERTICAL | wx.TB_DOCKABLE )

toolbar.AddLabelTool(wx.ID_ANY, ‘’, wx.ArtProvider.GetBitmap

(wx.ART_NEW, wx.ART_TOOLBAR, tsize))

   toolbar.AddLabelTool(wx.ID_ANY, '', wx.ArtProvider.GetBitmap

(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize))
toolbar.Realize()

   self.Centre()

   self.Show(True)

app = wx.App()

VerticalToolbar(None, -1, ‘vertical toolbar’)

app.MainLoop()

miro.kubiczek wrote:

Hi,

I am writing an applications that has a dockable toolbar with
(wx.TB_DOCKABLE). The problem is when I move the toolbar (floating
now) it disappears behind the window when the focus is on the window.

Native toolbar docking is totally handled by GTK and the window manager, I don't think wx has any control over it other than enabling the docking ability when the style flag is given. That said, on my lunix box the floating toolbar does not go behind the parent frame and stays on top of it like it should, so my guess is that this may be a GTK bug.

···

--
Robin Dunn
Software Craftsman