Winston Ewert
Winston Ewert

Reputation: 45089

Captionless wxPython Window Hides Taskbar

This code:

import wx

app = wx.App()
frame = wx.Frame(None, style = wx.DEFAULT_FRAME_STYLE & ~wx.CAPTION)
frame.Maximize()
frame.Show()
app.MainLoop()

Produce a frame covering the whole screen, including my taskbar. Is there a way to make it only take up the screen not taken by the taskbar?

Upvotes: 2

Views: 1014

Answers (4)

user7418923
user7418923

Reputation: 71

I would like to place a follow-up solution here, since the above question appears still valid and the problem arises in C++ as well.

A possible and rather general solution is to apply the default frame style before maximizing, then revert to your custom (captionless) style afterwards.

The successfully tested C++ version reads:

frame->SetWindowStyle(wxDEFAULT_FRAME_STYLE);
frame->Maximize(true);
frame->SetWindowStyle(wxRESIZE_BORDER);

Under Windows 10, this results in the caption bar briefly flashing, but the effect appears minor.

Upvotes: 1

Jack Zhu
Jack Zhu

Reputation: 11

Get the working area position and size without taskbar:

c_x, c_y, c_w, c_h = wx.ClientDisplayRect()

Set pos and size:

frame = wx.Frame(None, pos=(c_x, c_y), size=(c_w, c_h),
                      style=wx.DEFAULT_FRAME_STYLE & ~wx.CAPTION & ~wx.RESIZE_BORDER)

Upvotes: 1

Michael Scott
Michael Scott

Reputation: 429

For future people looking. Trying using ShowFullScreen(True)

I'm new to wx but try using self.ShowFullScreen(True) or frame.ShowFullScreen(True)

Upvotes: 0

Mike Driscoll
Mike Driscoll

Reputation: 33111

From what I can see, I would say no, you can't do it with the Maximize method. You could probably fake it by getting the screen size and setting the frame's seize to that minus the space for the taskbar. You may have to find a way to get the taskbar's position as some people don't leave it on the bottom.

Upvotes: 2

Related Questions