我已经通过
在wx python中指定了大小 super(BrightnessController, self).__init__(parent, title=title, size=(330, 100))
。
如何完全禁用调整大小?
来源:https://github.com/lordamit/Brightness/blob/master/src/brightness.py
答案 0 :(得分:1)
设置最小和最大尺寸将阻止框架调整大小超过为它们设置的尺寸。
import wx
class BrightnessController(wx.Frame):
def __init__(self, parent, title):
super(BrightnessController, self).__init__(parent, title=title,
size=(330, 100))
self.SetMinSize((330, 100))
self.SetMaxSize((330, 100))
self.Show()
if __name__ == '__main__':
app = wx.App()
BrightnessController(None, title='Brightness Controller')
app.MainLoop()
另一种方法是将样式设置为DEFAULT_DIALOG_STYLE,如果您仍希望最小化MINIMIZE_BOX
import wx
class BrightnessController(wx.Frame):
def __init__(self, parent, title):
super(BrightnessController, self).__init__(parent, title=title,
size=(330, 100), style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX)
self.Show()
if __name__ == '__main__':
app = wx.App()
BrightnessController(None, title='Brightness Controller')
app.MainLoop()
答案 1 :(得分:1)
尝试: super(BrightnessController,self)。 init (parent,title = title,size =(330,100),style = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)