wxpython 中的多个面板 [英] multiple panel in wxpython

查看:38
本文介绍了wxpython 中的多个面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

wxpython 可以有多个面板吗?我想要这样的东西:

Is it possible to have multiple panel in wxpython? I want to have something like this:

import wx.grid
import sys

class Mat_Frame(wx.Frame):
    def __init__(self,parent):

        wx.Frame.__init__(self,wx.GetApp().TopWindow,title='Material Properties')
        self.panel=wx.Panel(self,-1)
        self.AdderPanel=wx.Panel(self.panel,-1)
        self.InputPanel=wx.Panel(self.panel,-1)
        self.OutputPanel=wx.Panel(self.panel,-1)
        HorSizer=wx.BoxSizer(wx.HORIZONTAL)
        HorSizer.Add(self.panel,proportion=1,flag=wx.EXPAND|wx.ALL)
        HorSizer.Add(self.AdderPanel,proportion=1,flag=wx.EXPAND|wx.ALL)
        HorSizer.Add(self.InputPanel,proportion=1,flag=wx.EXPAND|wx.ALL)
        HorSizer.Add(self.OutputPanel,proportion=1,flag=wx.EXPAND|wx.ALL)

我试过这个,但它不起作用.我的意思是,我得到的奇怪的窗口大小不正确.我在这里做错了吗?有人可以指点我如何在 wxpython 中使用多个面板吗?

I tried this but it is not working. I mean, I get weird window unsized properly. Am I doing something wrong here? Can somebody point me how to use multiple panels in wxpython?

推荐答案

抱歉,我刚刚发现我忘记设置 sizer.在那之后它工作得很好.

Sorry, I just realized I had forgotten to set the sizer. It worked fine after that.

这篇关于wxpython 中的多个面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆