代&&小白
2021-05-25 20:27
采纳率: 100%
浏览 31

wxpython 高级窗口 怎样分为多栏

import wx


class MyFrame(wx.Frame):
    def __init__(self):
        super().__init__(parent=None, title='高级窗口', size=(350, 180))
        self.Center()
        splitter = wx.SplitterWindow(self, -1)
        leftpanel = wx.Panel(splitter)
        rightpanel = wx.Panel(splitter)
        splitter.SplitVertically(leftpanel, rightpanel, 100)
        splitter.SetMinimumPaneSize(80)
        splitter_right = wx.SplitterWindow(rightpanel, -1)
        rightpanel_top = wx.Panel(rightpanel)
        rightpanel_bottom = wx.Panel(rightpanel)
        splitter_right.SplitHorizontally(rightpanel_top, rightpanel_bottom, -1)
        list2 = ['苹果', '桔子', '香蕉', '椰子', '1', '2', '3', '4', '5', '6', '7']
        lb2 = wx.ListBox(leftpanel, -1, choices=list2, style=wx.LB_SINGLE)
        self.Bind(wx.EVT_LISTBOX, self.listbox, lb2)
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(lb2, 1, flag=wx.ALL | wx.EXPAND, border=5)
        leftpanel.SetSizer(vbox)

        vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.text = wx.StaticText(rightpanel_top, label='右上侧面板')
        vbox2.Add(self.text, 1, flag=wx.ALL | wx.EXPAND, border=5)

        vbox3 = wx.BoxSizer(wx.VERTICAL)
        self.text1 = wx.StaticText(rightpanel_top, label='右下侧面板')
        vbox3.Add(self.text, 1, flag=wx.ALL | wx.EXPAND, border=5)

    def listbox(self, event):
        s = '选择{0}'.format(event.GetString())
        self.text.SetLabel(s)
        pass


class App(wx.App):
    def OnInit(self):
        frame = MyFrame()
        frame.Show()
        return True


app = App()
app.MainLoop()

求大神帮我改改,我想把它分为左侧,右上,右下三栏,应该怎么写

  • 好问题 提建议
  • 收藏

2条回答 默认 最新

  • CSDN专家-黄老师 2021-05-25 21:12
    已采纳

    wxpython 有个界面设计软件:wxFormBuilder,可以参考一下:https://xyhuang.blog.csdn.net/article/details/61195367,如有帮助,望采纳,谢谢

    已采纳该答案
    评论
    解决 1 无用
    打赏 举报
  • 有问必答小助手 2021-05-26 11:04

    您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

    如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

    ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题