开发者

wxpython - Need help adjusting GUI

开发者 https://www.devze.com 2023-03-11 08:39 出处:网络
Working on a program (found here, the files are longer, so posting them here would take up much space). 开发者_StackOverflow中文版My problem with it is that the main panel of gui_step_1.py is way off

Working on a program (found here, the files are longer, so posting them here would take up much space). 开发者_StackOverflow中文版My problem with it is that the main panel of gui_step_1.py is way off center from where it should be.

I have tried numerous things, including adding it to a sizer to straighten it out, but because of my program structure (MVC) I can't do that because I instantiate controller in gui_step_1.py and controller does not inherit panel, frame, or anything related to wx (just a normal class).

What I need is pretty obvious once you see my program: I need step1 (instance of controller in gui_step_1.py) centered on the window.

Thanks for the help!


I didn't sort through everything, but I think self.v.Center() in your controller class in gui_step_1.py is repositioning a Panel within its Frame instead of centering the Frame. Get rid of that, and things seem to line up properly. If you want to add the panel to a sizer, you'll probably have to retrieve it from the controller class.

The trouble you're having with the interface is more a symptom of a design problem, though. Your view frame creates instances of two different classes, which create instances of widgets which are children of the frame. Although you're trying to use MVC, it shouldn't be changing the way you add a widget to a frame.

0

精彩评论

暂无评论...
验证码 换一张
取 消