schwedenmann
Foren Gott
Hallo
Warum sind in dem Beispiel die Radiuobuttons nicht sichtbar ?
Ja ich weiß, mit sizern wäre das Ganze besser, ist aber nur mein Anfang mit wx.Python, aber es sollte prinzipiell doch auch so (ohne sizer + abolute Positionen) gehen.
Das Ganze soll später mal ein Finanz-mathe-Rechner (Zinbseszins, Renten,Darlehn + plotten) werden. Mit den RadioButtons wollte ich später 2x jeweils einen neuen frame aufrufen.
mfg
schwedenmann
Warum sind in dem Beispiel die Radiuobuttons nicht sichtbar ?
Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# spinctrl.py
import wx
class MyDialog(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(350, 310))
wx.StaticText(self, -1, 'Bitte wählen sie aus', (200,1))
self.SetBackgroundColour('Green')
pnl = wx.Panel(self)
self.rb1 = wx.RadioButton(pnl, label='Zinseszins', pos=(10, 5),
style=wx.RB_GROUP)
self.rb2 = wx.RadioButton(pnl, label='Darlehn', pos=(10, 35))
self.rb3 = wx.RadioButton(pnl, label='Renten C', pos=(10, 65))
self.rb1.Bind(wx.EVT_RADIOBUTTON, self.SetVal)
self.rb2.Bind(wx.EVT_RADIOBUTTON, self.SetVal)
self.rb3.Bind(wx.EVT_RADIOBUTTON, self.SetVal)
clear_btn = wx.Button(self, 1, 'Beenden', (185, 250))
self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
self.Destroy()
def SetVal(self, e):
state1 = str(self.rb1.GetValue())
state2 = str(self.rb2.GetValue())
state3 = str(self.rb3.GetValue())
class MyApp(wx.App):
def OnInit(self):
dlg = MyDialog(None, -1, 'Zinseszins.py')
dlg.Show(True)
dlg.Centre()
return True
app = MyApp(0)
app.MainLoop()
Ja ich weiß, mit sizern wäre das Ganze besser, ist aber nur mein Anfang mit wx.Python, aber es sollte prinzipiell doch auch so (ohne sizer + abolute Positionen) gehen.
Das Ganze soll später mal ein Finanz-mathe-Rechner (Zinbseszins, Renten,Darlehn + plotten) werden. Mit den RadioButtons wollte ich später 2x jeweils einen neuen frame aufrufen.
mfg
schwedenmann
Zuletzt bearbeitet von einem Moderator: