Reputation: 45089
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?
OS: Windows XP
Python: 2.7.3
Upvotes: 2
Views: 1014
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
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
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
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