23/07/2019, 22:35
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()
24/07/2019, 02:29
24/07/2019, 05:19
global var1, var2,
class TabOne(wx.Panel):
def __init__(self, parent):
global var1, var2, etc #variabili numeriche di una funzione esterna. Da locali rese globali
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is the first tab", (20,20))
t = wx.StaticText(self, -1, "Descrizione 1: ", (20,40))
t = wx.StaticText(self, -1, "Descrizione 2 ", (20,60))
st1 = wx.StaticText(self, label='', pos=(150, 40))
st1.SetLabel(str(var1)+' :')
st2 = wx.StaticText(self, label='', pos=(40, 60))
st2.SetLabel(str(var2))
font = t.GetFont()
font.SetPointSize(10)
t.SetFont(font)
st1 = wx.StaticText(self, label='', pos=(150, 40))
st1.SetLabel(str(var1)+' :')
Skuola.net News è una testata giornalistica iscritta al Registro degli Operatori della Comunicazione.
Registrazione: n° 20792 del 23/12/2010.
©2000—
Skuola Network s.r.l. Tutti i diritti riservati. — P.I. 10404470014.
Powered by phpBB © phpBB Group - Privacy policy - Cookie privacy
phpBB Mobile / SEO by Artodia.