Ho trovato questo codice su internet, o meglio, ciascun tab era in realtà una classe. Io l'ho modificato per poter inserire le mie funzioni di calcolo. Avrei bisogno di una finestra a tab su cui inserire i miei risultati e grafici.
Questo codice mi ritorna errore nel punto in cui aggiungo tab AddPage(), ma se lascio le diverse classi non riesco poi ad utilizzare le variabili locali della mia funzione.
Non è da molto che programmo
Qualcuno potrebbe aiutarmi gentilmente??? Grazie!!!
- Codice:
import wx
class Tab(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.TabOne(), self.TabTwo(), self.TabThree(), self.TabFour()
def TabOne(self):
wx.StaticText(self, -1, "This is the first tab", (20,20))
def TabTwo(self):
wx.StaticText(self, -1, "This is the second tab", (20,20))
def TabThree(self):
wx.StaticText(self, -1, "This is the third tab", (20,20))
def TabFour(self):
wx.StaticText(self, -1, "This is the last tab", (20,20))
class SubFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="wxPython tabs example")
# super(SubFrame, self).__init__(None, title ="wxPython", size = (950,990))
p = wx.Panel(self)
nb = wx.Notebook(p)
# Create the tab windows
tab1 = Tab.TabOne(nb)
tab2 = Tab.TabTwo(nb)
tab3 = Tab.TabThree(nb)
tab4 = Tab.TabFour(nb)
# Add the windows to tabs and name them.
nb.AddPage(tab1, "Analysis Network")
nb.AddPage(tab2, "")
nb.AddPage(tab3, "")
nb.AddPage(tab4, "")
# Set noteboook in a sizer to create the layout
sizer = wx.BoxSizer()
sizer.Add(nb, 1, wx.EXPAND)
p.SetSizer(sizer)
def main():
app = wx.App()
SubFrame().Show()
app.MainLoop()
if __name__ == '__main__':
main()