Reisze wx.Dialog horizontally only
Is there a way to allow a custom wx.Dialog to be resized in the horizontal direction only? I've tried using GetSize() and then setting the min and max height of the window using SetSizeHints(), but for some reas开发者_如何学Con it always allows the window to be resized just a little, and it looks rather tacky. The only other alternative I have come up with is to hard-code the min and max height, but I don't think that would be such a good idea...
Relevant code:
class SomeDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, title="blah blah",
style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
size = self.GetSize()
self.SetSizeHints(minW=size.GetWidth(), minH=size.GetHeight(),
maxH=size.GetHeight())
os: Windows 7
python version: 2.5.4 wxPython version: 2.8.10If you don't want the height to change, why would it be a bad idea to set min and max height to the same value (the one you want to force)? You can of course get the system estimate of the "best value" with GetBetSize
or related methods. Though I find the fact that setting the size hints doesn't have the same effect (as I think it should) peculiar... what platform are you using wxpython on, and what version of Python, wxpython, and the platform/OS itself...?
精彩评论