masklinn í dag viðrar vel til loftárása | Code :
- #!/bin/env python
- # -*- coding: iso-8859-1 -*-
- import wx
- class MyDialog(wx.Dialog):
- def __init__(self, parent, id, title):
- wx.Dialog.__init__(self, parent, id, title)
- self.parent = parent
- self.Bind(wx.EVT_CLOSE, self.OnClose)
-
- def OnClose(self, event):
- self.parent.OnSupButton(event)
-
- class MyFrame(wx.Frame):
- def __init__(self, parent, ID, title):
- wx.Frame.__init__(self, parent, ID, title, size = (200,100))
-
- self.mybutton = wx.Button(self, wx.NewId(), "Initial" )
-
- self.Bind(wx.EVT_BUTTON, self.OnInitialButton, id = self.mybutton.GetId())
-
- self.dlg = None
-
- self.Show(True)
-
- def OnInitialButton(self, event):
- self.mybutton.SetLabel("\'Sup" )
- self.Bind(wx.EVT_BUTTON, self.OnSupButton, id = self.mybutton.GetId())
- self.dlg = MyDialog(self, -1, "Test Dialog" )
- self.dlg.Show(True)
-
- def OnSupButton(self, event):
- self.mybutton.SetLabel("Initial" )
- self.Bind(wx.EVT_BUTTON, self.OnInitialButton, id = self.mybutton.GetId())
- if self.dlg:
- self.dlg.Destroy()
-
- app = wx.PySimpleApp()
- frame = MyFrame(None, -1, "Test Frame" )
- app.MainLoop()
| Crée une wx.Frame avec un gros bouton "Initial" clic sur initial -> devient un bouton "'Sup" et ouvre une boite de dialog clic sur 'Sup -> fermeture du dialog + retour a bouton "Initial" fermeture du dialog -> retour au bouton "Initial" sur la frame (suffit d'enlever le self.Bind du dialog pour que ca dégage) Message édité par masklinn le 04-03-2007 à 18:44:45 ---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
|