mfg cime
Code: Alles auswählen
import wx
import time
import wx.lib.scrolledpanel as scrolled
DEUTSCH={
'title':'Chat',
'file':'Datei',
'new':'Neu',
'new status bar':'Zeichnet eine neue Funktion',
'exit':'Beenden',
'exit status bar':'Beendet das Programm',
'edit':'Bearbeiten',
'config':'Einstellungen',
'config status bar':'Konfigurieren des Programms',
'quest exit':'Wollen Sie wirklich beenden?',
'exit title':'Beenden ...',
}
COLOR={
'bg':'white',
'name':'yellow',
'off':'red',
'on':'green',
}
class scrolledpanel(scrolled.ScrolledPanel):
def __init__(self,parent,id):
self.color=COLOR
scrolled.ScrolledPanel.__init__(self,parent, id,style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
self.SetBackgroundColour(wx.NamedColour(self.color['bg']))
self.fgs = wx.FlexGridSizer(cols=2, vgap=4, hgap=4)
self.SetSizer( self.fgs )
self.font = wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD)
label = wx.StaticText(self, -1, 'cime',size=(130,-1))
label.SetBackgroundColour(wx.NamedColour(self.color['name']))
label.SetFont(self.font)
label2 = wx.StaticText(self, -1, 'off')
label2.SetBackgroundColour(wx.NamedColour(self.color['off']))
label3 = wx.StaticText(self, -1, 'next',size=(130,-1))
label3.SetBackgroundColour(wx.NamedColour(self.color['name']))
label4 = wx.StaticText(self, -1, 'on')
label4.SetBackgroundColour(wx.NamedColour(self.color['on']))
self.fgs.Add(label, flag=wx.ALIGN_LEFT)
self.fgs.Add(label2, flag=wx.ALIGN_CENTER)
self.fgs.Add(label3, flag=wx.ALIGN_LEFT)
self.fgs.Add(label4, flag=wx.ALIGN_CENTER)
self.SetAutoLayout(1)
self.SetupScrolling()
class statusbar(wx.StatusBar):
def __init__(self,parent,id):
wx.StatusBar.__init__(self, parent, id)
self.timer = wx.PyTimer(self.increase_time)
self.timer.Start(1000)# = 24h
self.increase_time()
def increase_time(self):
t = time.localtime(time.time())
st = time.strftime("%d. %B %y %I:%M:%S", t)
self.SetStatusText(st)
class myframe(wx.Frame):
def __init__(self,parent,dic):
self.lang=dic #lang --> language
wx.Frame.__init__(self,parent,-1,dic['title'],wx.DefaultPosition,(170,420))
menu=wx.Menu()
menu.Append(1001,dic['new'],dic['new status bar'])
menu.AppendSeparator()
menu.Append(1002,dic['exit'],dic['exit status bar'])
menubar=wx.MenuBar()
menubar.Append(menu,dic['file'])
menu=wx.Menu()
menu.Append(1003,dic['config'],dic['config status bar'])
menubar.Append(menu,dic['edit'])
self.SetMenuBar(menubar)
others=scrolledpanel(self,-1)
self.status=statusbar(self,-1)
self.SetStatusBar(self.status)
class app(wx.App):
def OnInit(self):
frame = myframe(None,DEUTSCH)
self.SetTopWindow(frame)
frame.Show(True)
return True
if __name__=='__main__':
main=app()
main.MainLoop()