调整 wxPython 窗口的大小
是否有可能使 wxPython 窗口的大小只能调整到一定的比例?我知道你可以禁用调整大小;但是,我希望在调整窗口大小时它保持一定的宽高比。
Is it possible to make a wxPython window only re-sizable to a certain ratio? I know you can disable resizing; however, I'd like it so when the window was resized it stuck to a certain width to height ratio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种明显的方法是将 wx.EVT_SIZE 绑定到限制宽高比的函数。我不确定这是否是执行此操作的正确方法,但它有效:(
样板是从 此处借用的< /a>。)
One obvious way to do this would be to bind
wx.EVT_SIZE
to a function that constrains the aspect ratio. I'm not certain this is The Right Way to do this, but it works:(The boilerplate is borrowed from here.)
我对 wxPython 不太熟悉,但是一旦用户通过,你不能将窗口大小重置为你想要的最大/最小大小吗?最好是在检测到调整大小的情况下?
I'm not too familiar with wxPython, but can't you just reset the window size to your max/min size that you want once the user pass that? Preferably in the event that detects resizing?