Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用wxPython';s wx.TextCtrl阻止表单的其余部分_Python_Wxpython - Fatal编程技术网

使用wxPython';s wx.TextCtrl阻止表单的其余部分

使用wxPython';s wx.TextCtrl阻止表单的其余部分,python,wxpython,Python,Wxpython,我正在使用wxPython构建表单。我是wxpython的新手。我的第一张表格正确打开,当您按下旅行咨询按钮时,第二张表格打开。这是用户输入信息的地方。当我使用这行代码输入文本时: self.logger=wx.TextCtrl(self,pos=(100145),size=(140,-1)) 它将删除表单上的所有其他内容。把这行注释掉,表格就好了。我很难弄明白这一点,似乎在网上找不到好的答案。这是到目前为止我的代码。任何帮助都会很好 import wx # varialbes title =

我正在使用wxPython构建表单。我是wxpython的新手。我的第一张表格正确打开,当您按下旅行咨询按钮时,第二张表格打开。这是用户输入信息的地方。当我使用这行代码输入文本时:
self.logger=wx.TextCtrl(self,pos=(100145),size=(140,-1)) 它将删除表单上的所有其他内容。把这行注释掉,表格就好了。我很难弄明白这一点,似乎在网上找不到好的答案。这是到目前为止我的代码。任何帮助都会很好

import wx

# varialbes
title = 'Advisory Form'
closuretypeList = ['is closed ', 'is open', 'closed for season ', 'open for season ']
stateList = ['Alabama','Alaska']
analystList = []
dotPhoneList = []
dotWebList = []

class formMS(wx.Frame):
    #formMS is main switchboard
    def __init__(self, parent, title):
        # create form
        super(formMS, self).__init__(parent,title=title,size=(225, 350))
        panel = wx.Panel(self, -1)

        font1 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD, True)

        #add static labels
        text1 = wx.StaticText(panel, -1, "FORMS", (55, 15))
        text1.SetFont(font1)

        text2 = wx.StaticText(panel, -1, "REPORTS", (55, 110))
        text2.SetFont(font1)

        #Form buttons
        self.buttonTAForm = wx.Button(panel,id=wx.ID_OPEN, label="Travel Advisory", pos = (55, 40))
        self.buttonTAForm.Bind(wx.EVT_BUTTON, self.OnClick, self.buttonTAForm)

        self.buttonDOTForm = wx.Button(panel,id=wx.ID_ANY, label="DOT Contacts", pos = (55, 75))

        #Report Buttons
        self.buttonTARep = wx.Button(panel,id=wx.ID_ANY, label="TA Report", pos = (55, 140))
        self.buttonDOTContactRep = wx.Button(panel,id=wx.ID_ANY, label="DOT Contacts", pos = (55, 175))

        #cancel button
        self.buttonCancel = wx.Button(panel,id=wx.ID_CANCEL, label="Close",pos = (55,225))
        self.buttonCancel.Bind(wx.EVT_BUTTON, self.OnCloseMe)
        self.buttonCancel.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

        self.Centre()
        self.Show()

    def OnClick(self, event):
        secondWindow = formTAN(self)
        secondWindow.Show()

    def OnCloseMe(self, event):
        self.Close(True)

    def OnCloseWindow(self, event):
        self.Close(True)

class formTAN(wx.Frame):

    #formTAN is Travel Advisory Notice Form
    def __init__(self, parent):
        # create form
        super(formTAN, self).__init__(parent,size=(550, 650))

        panel = wx.Panel(self, -1)

        font1 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD, True)
        font2 = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False)

        self.logger = wx.TextCtrl(self, pos=(100, 145), size=(140,-1))

        #Label Panel
        self.lblname = wx.StaticText(panel, -1, "TRAVEL ADVISORY FORM", (170, 15))
        self.lblname.SetFont(font1)

        #Clears form to create a new record
        self.buttonNew = wx.Button(panel,id=wx.ID_ANY, label="New Record", pos = (55, 40))

        #Exits Form
        self.buttonCancel = wx.Button(panel,id=wx.ID_CANCEL, label="All Clear/Exit",pos = (380,40))
        self.buttonCancel.Bind(wx.EVT_BUTTON, self.OnCloseMe)

        #Selects type of closure
        self.lblname = wx.StaticText(panel, -1, "Closure Type", (10, 85))
        self.lblname.SetFont(font2)
        self.choClosureType = wx.Choice(panel,-1, (100, 85),choices=closuretypeList)
        # self.choClosureType.Bind(wx.EVT_CHOICE, self.OnSelect)

        #Drop down list of states/provinces
        self.lblname = wx.StaticText(panel, -1, "State", (10, 115))
        self.lblname.SetFont(font2)
        self.choStateType = wx.Choice(panel,-1, (100, 115),choices=stateList)
        # self.choClosureType.Bind(wx.EVT_CHOICE, self.OnSelect)

        #Enter strip map number
        self.lblname = wx.StaticText(panel, -1, "Strip #:", (250, 115))
        self.lblname.SetFont(font2)
        # self.editname = wx.TextCtrl(self, value="", pos=(100, 145), size=(140, -1))
        # self.Bind(wx.EVT_TEXT, self.EvtText, self.editname)
        # self.Bind(wx.EVT_CHAR, self.EvtChar, self.editname)

        #Enter route name
        self.lblname = wx.StaticText(panel, -1, "Road Name:", (10, 145))
        self.lblname.SetFont(font2)

        #Enter area in question
        self.lblname = wx.StaticText(panel, -1, "To / From:", (250, 145))
        self.lblname.SetFont(font2)

        #Extra Details
        self.lblname = wx.StaticText(panel, -1, "Description:", (10, 175))
        self.lblname.SetFont(font2)
        # self.logger = wx.TextCtrl(self, pos=(100, 170), size=(400, 150), style=wx.TE_MULTILINE | wx.TE_READONLY)

        #Dot Phone number
        self.lblname = wx.StaticText(panel, -1, "DOT Phone:", (10, 275))
        self.lblname.SetFont(font2)
        self.choDotPhoneType = wx.Choice(panel,-1, (100, 275),choices=dotPhoneList)

        #DOT websites
        self.lblname = wx.StaticText(panel, -1, "DOT Website:", (250, 275))
        self.lblname.SetFont(font2)
        self.choDotWebType = wx.Choice(panel,-1, (350, 275),choices=dotWebList)

        #Analyst list
        self.lblname = wx.StaticText(panel, -1, "Analyst:", (10, 305))
        self.lblname.SetFont(font2)
        self.choAnalystType = wx.Choice(panel,-1, (100, 305),choices=analystList)

    def OnCloseMe(self, event):
        self.Close(True)

        self.Centre()
        self.Show()

if __name__ == '__main__':

    app = wx.App()
    formMS(None, title='Travel Advisory')
    app.MainLoop()
在#创建你的类formTAN的一部分

self.logger = wx.TextCtrl(self, pos=(100, 145), size=(140,-1))
self.logger = wx.TextCtrl(self, pos=(100, 170), size=(400, 150),
    style=wx.TE_MULTILINE | wx.TE_READONLY)
作为自我的父母,它需要作为自我之子的小组的父母

self.logger = wx.TextCtrl(panel, pos=(100, 145), size=(140,-1))
你班的#额外细节部分formTAN

self.logger = wx.TextCtrl(self, pos=(100, 145), size=(140,-1))
self.logger = wx.TextCtrl(self, pos=(100, 170), size=(400, 150),
    style=wx.TE_MULTILINE | wx.TE_READONLY)
也是自我的父母,所以也需要父母的面板,其高度150使其覆盖其他控件, 将“高度”更改为100可以解决此问题

self.logger = wx.TextCtrl(panel, pos=(100, 170), size=(400, 100),
    style=wx.TE_MULTILINE | wx.TE_READONLY)

谢谢,它工作得很好。我理解我的错误。