App without icon?

Is it possible to configure an App and its windows, so that they do not show up on the panel (Linux Mint)?

Not sure it belongs to the app level, it’s something to decide on each window. In the frame, add wx.FRAME_NO_TASKBAR to the style. That should make the frame to stop appearing in the taskbar/tray.

That works indeed with the following minimal example:

import wx

app = wx.App()

frame = wx.Frame(
    None,
    id=wx.ID_ANY,
    title='No taskbar',
    style=wx.FRAME_NO_TASKBAR,
)
frame.Show()

app.MainLoop()

But it does not work in my application. I’ll try to make a minimal example …

I found the reason: If I later set the wx.STAY_ON_TOP style flag for the frame, the window appears on the panel:

import wx

app = wx.App()

frame = wx.Frame(
    None,
    id=wx.ID_ANY,
    title='No taskbar',
    style=wx.FRAME_NO_TASKBAR,
)
frame.SetWindowStyleFlag(wx.STAY_ON_TOP)
frame.Show()

app.MainLoop()

If I do not want to set the style with the style parameter, it seems, that order matters:

import wx

app = wx.App()

frame = wx.Frame(
    None,
    id=wx.ID_ANY,
    title='No taskbar',
)
frame.SetWindowStyleFlag(wx.STAY_ON_TOP)
frame.SetWindowStyleFlag(wx.FRAME_NO_TASKBAR)
frame.Show()

app.MainLoop()

This works as intended! (But why?)

As to why, my guess is that stay_on_top clears no_taskbar, i.e. sets that to false, overrides it. So if you override it back, it works. You may check this in a debugger, perhaps.

try

style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_NO_TASKBAR

Yes, indeed, that’s one possibility, which works.

But it is not always that easy. After this discussion, I have already changed

frame = wx.Frame(None, style=wx.FRAME_NO_TASKBAR)
if not config['show_border']:
    frame.SetWindowStyleFlag(wx.BORDER_NONE)
if config['stay_on_top']:
    frame.SetWindowStyleFlag(wx.STAY_ON_TOP)

to

style = wx.FRAME_NO_TASKBAR
if not config['show_border']:
    style |= wx.BORDER_NONE
if config['stay_on_top']:
    style |= wx.STAY_ON_TOP
frame = wx.Frame(None, style=style)

which works as expected. But I believe the first approach is easier to understand.

Is the described behaviour considered a bug?

according to the docu not at all ! :smiling_face_with_tear:

If I read the documentation correctly, it says “that some styles cannot be changed after the window creation.” It does not say, “that some styles fiddle some previously set styles.”

well, I don’t know the difference of changing and fiddling but there are more places with quite complex initializations so that a dynamic setting afterwards is dicey, I think (it also depends on the conditions of the underlying library) :stuck_out_tongue_closed_eyes:

Styles can be individually on or off, so what this does:

frame.SetWindowStyleFlag(wx.STAY_ON_TOP)

is turn only the STAY_ON_TOP flag on and turn all other flags off. If you want multiple flags at the same time, you have to or them.

See documentation here:
https://docs.wxpython.org/window_styles_overview.html#window-styles

2 Likes

That makes sense indeed and explains the behaviour (I just never noticed this in my examples …) Thanks for the explanation of this behaviour!

Still this is not clearly mentioned in Windows Styles Overview nor in SetWindowStyleFlag. I consider this then a documentation bug …