boa构造函数框架未启动

2024-04-25 13:04:10 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我在Boa构造函数中的第一个应用程序,也是我第一次使用wxPython。在

#Boa:Frame:Frame1

import wx

choiceList = ['DAR', 'Impex', 'Endon', 'Astro', 'Ansell', 'Other']

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1BUTTONSELECTDIR, wxID_FRAME1BUTTONSELECTFILE, 
 wxID_FRAME1CHOICESUPPLIER, 
] = [wx.NewId() for _init_ctrls in range(4)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(517, 20), size=wx.Size(400, 492),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(392, 458))

        self.choiceSupplier = wx.Choice(choices=choiceList, id=wxID_FRAME1CHOICESUPPLIER,
              name=u'choiceSupplier', parent=self, pos=wx.Point(48, 176),
              size=wx.Size(120, 21), style=0)
        self.choiceSupplier.Bind(wx.EVT_CHOICE, self.OnChoiceSupplierChoice,
              id=wxID_FRAME1CHOICESUPPLIER)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnChoiceSupplierChoice(self, event):
        supplier = choiceList[self.choiceSupplier.GetSelection()]
        print supplier

单击“运行应用程序”时,我的代码运行良好。但是,当我试图在designer中编辑它时,我得到一个错误:

^{pr2}$

Tags: selfidsizeinitdefframeparentwx
1条回答
网友
1楼 · 发布于 2024-04-25 13:04:10

偶然发现这个问题,而寻找其他一些有关的boa建造者,抱歉,如果回答有点死板的帖子在这里被认为是失礼,我是新来的。在

不管怎样,我最好的猜测是,即使有“不要编辑”的评论,你自己也会搞乱。我自己也试过几次,博亚处理得不太好。更换后

self.choiceSupplier = wx.Choice(choices=choiceList

^{pr2}$

您可以再次进入设计器,并能够拥有该设计器并填充wx.选择项目I将列表移到init内:

^{3}$

问题可能在于设计器会话如何分析文件,而忽略了类外部的列表。在

相关问题 更多 >

    热门问题