Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.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 完全删除wx.Python中的GridBagSizer_Wxpython - Fatal编程技术网

Wxpython 完全删除wx.Python中的GridBagSizer

Wxpython 完全删除wx.Python中的GridBagSizer,wxpython,Wxpython,早上好 我正在使用wx.BoxSizer中的wx.GridBagSizer对结果表进行编码。更新新数据后,我希望完全删除GridBagSizer,创建一个新的GridBagSizer,并在新的GridBagSizer上显示新结果。但是,当我更新数据时,值会正确更新,但新的GridBagSizer会移动到一个位置,就像以前的GridBagSizer仍然存在一样 你能帮我吗? 谢谢 我发现,在创建新GridBagSizer时,它缺少一行“self.gbsint.SetEmptyCellSize((0

早上好

我正在使用wx.BoxSizer中的wx.GridBagSizer对结果表进行编码。更新新数据后,我希望完全删除GridBagSizer,创建一个新的GridBagSizer,并在新的GridBagSizer上显示新结果。但是,当我更新数据时,值会正确更新,但新的GridBagSizer会移动到一个位置,就像以前的GridBagSizer仍然存在一样

你能帮我吗? 谢谢


我发现,在创建新GridBagSizer时,它缺少一行“self.gbsint.SetEmptyCellSize((0,0)),从而有效地不考虑前面列和行的存在。

如果保存对GridBagSizer的引用,则可以调用其
Destroy
方法将其删除。请注意,您可能需要先删除其子项。
    def actualiza_res(self, presas_sel):
    self.presas_sel = presas_sel
    esquema = self.link_principal.esquema
    if esquema["modelos"] and esquema["res_prio"]==False:
        self.gbsint.Clear(True)
        self.gbsint.Layout()
        self.Refresh()
        self.Update()

        self.gbsint=wx.GridBagSizer(vgap=10, hgap=10)
        self.gbsint.Layout()
        self.Refresh()
        self.Update()
        text11=wx.StaticText(self, -1,_('Current situation'))
        font11 = wx.Font(12, wx.ROMAN, wx.NORMAL, wx.BOLD)
        text11.SetFont(font11)
        self.gbsint.Add(text11, (3, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)
        self.ct=['-']*(len(self.resct))
        self.ec=['-']*len(self.resec)
        self.ps=['-']*len(self.resps)
        self.dpa=['-']*len(self.resdpa)
        j=4
        for res in range(len(self.ct)):
            self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["CRIDPA"][2][res])),(j, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)
            j += 1
        j=11
        for res in range(len(self.ec)):
            self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["CRIDPA"][2][res])),(j, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)
            j += 1
        j=18
        for res in range(len(self.ps)):
            self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["CRIDPA"][2][res])),(j, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)
            j += 1
        #self.totalcri=wx.StaticText(self, -1, _('-'), style=wx.ALIGN_CENTER)
        self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["riesgo"][0])),(27, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40) #Total CRI
        j=29
        for res in range(len(self.dpa)):
            self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["CRIDPA"][2][res])),(j, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)
            j += 1

        #self.totaldpa=wx.StaticText(self, -1, _('-'), style=wx.ALIGN_CENTER)
        self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["riesgo"][2])),(33, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40) #TOTalDPA
        #self.totalr=wx.StaticText(self, -1, _('-'), style=wx.ALIGN_CENTER)
        self.gbsint.Add(wx.StaticText(self, -1,str(esquema["modelos"][presas_sel[-1]]["riesgo"][4])),(34, 1), flag=wx.LEFT|wx.ALIGN_CENTER, border=40)#Clase

       #Datos actuales de la presa
        self.textos["presas"].SetLabel(str(esquema["modelos"][presas_sel[-1]]["presas"])) #Nombre de la presa
        self.textos["Fecha ultima inspeccion"].SetLabel(str(esquema["modelos"][presas_sel[-1]]["Fecha ultima inspeccion"]))#ultima inspeccion
        self.textos["riesgo"].SetLabel(str(esquema["modelos"][presas_sel[-1]]["riesgo"][-1])) #Classe        
        self.sizer_hor.Add(self.gbsint,flag=wx.ALIGN_LEFT)
        self.SetupScrolling()

        self.Refresh()
        self.Layout()
        self.Update()