Ich arbeite an der Entwicklung einer Anwendung, bei der der Benutzer Informationen in Textfelder eingibt, die generiert werden, wenn ein Optionsfeld ausgewählt und die Informationen in einer CSV-Datei gespeichert werden. Wenn die Anwendung geöffnet wird, wird das erste Optionsfeld ausgewählt. Obwohl dies kein Problem ist, wird keines der Textfelder angezeigt. Wenn eines der Optionsfelder ausgewählt ist und das erste ausgewählt ist, erscheinen die Textfelder problemlos.Vorausgewählte Optionsschaltfläche funktioniert nicht wxPython
Hier ist der Code, der die Radiobuttons erzeugen:
self.radioStaticBox = wx.StaticBox(self.panel,-1,"Material Type: ")
self.radioStaticBoxSizer = wx.StaticBoxSizer(self.radioStaticBox, wx.VERTICAL)
self.radioBox = sc.SizedPanel(self.panel, -1)
self.radioBox.SetSizerType("horizontal")
self.isoRadioButton = wx.RadioButton(self.radioBox,-1, "Isotropic")
self.orthoRadioButton = wx.RadioButton(self.radioBox,-1, "Orthotropic")
self.orthotRadioButton = wx.RadioButton(self.radioBox,-1, "Orthotropic (with thickness)")
self.isoRadioButton.SetValue(True)
self.radioBox.Bind(wx.EVT_RADIOBUTTON, self.set_type)
Und die Funktion, die die Radio-Buttons gebunden werden:
für die Hilfedef generate_params(self, event):
self.matStaticBoxSizer.Clear(True)
if self.matType == "Iso":
idSb = wx.StaticBox(self.panel, 0, "Name:")
idSbs = wx.StaticBoxSizer(idSb, wx.HORIZONTAL)
self.idText = wx.TextCtrl(self.panel)
idSbs.Add(self.idText, 0, wx.ALL|wx.LEFT, self.margin)
....
Dank!