简体   繁体   中英

wxpython Disable Frame Resizing while keeping the RESIZE_BORDER style border

The style I like is: wx.STAY_ON_TOP | wx.RESIZE_BORDER

wxPython Disable Frame Resizing Following this suggestion the border vanishes. But I want to keep the style of RESIZE_BORDER just not its functionality.

This also does what I want:

self.SetMinSize(self.GetSize())
self.SetMaxSize(self.GetSize())

But it keeps the annoying re-size mouse pointer when hovering over the border.

I am trying to create a control similar to the volume control in windows 7 tray.

Thanks!

wxRESIZE_BORDER is not just some ornamentation, it indicates to the user that the window can be resized. Why do you want to lie to the user? If your window is not resizeable, don't use this style. There are other styles you may use to change the border appearance and you probably want to use a wxPopupWindow and not a usual wxFrame anyhow for something like volume control.

Invert or do not use the wxRESIZE_BORDER style when creating the frame.

Change the frame's background color to match the border or title bar color.

Create a panel with the frame as parent. Create a boxsizer.

Add the panel to sizer;

sizer.Add(panel, 1, wx.ALL | wx.EXPAND, 5). 

Set the sizer to the frame;

frame.SetSizer(sizer). 

You now have a 5 pixel display border with no mouse functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM