Skip to content

Instantly share code, notes, and snippets.

@batok
Created January 13, 2012 16:34
Show Gist options
  • Save batok/1607365 to your computer and use it in GitHub Desktop.
Save batok/1607365 to your computer and use it in GitHub Desktop.
Prueba de control de fecha de wx
import wx
from datetime import datetime
class Frame( wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,-1, "Probando Fecha , wx = {}".format(wx.__version__), size = ( 200,200))
self.panel = wx.Panel(self, -1)
f = datetime.today()
hoy = wx.DateTimeFromDMY(f.day, f.month - 1, f.year)
fecha = wx.DatePickerCtrl( self.panel, -1, wx.DefaultDateTime, wx.DefaultPosition, [140,-1], wx.DP_DROPDOWN|wx.DP_ALLOWNONE )
fecha.SetValue(hoy)
self.fecha = fecha
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
f = self.fecha.GetValue()
year, month, day = f.GetYear(), f.GetMonth() + 1, f.GetDay()
wx.MessageBox("%04d/%02d/%02d" % (year, month, day), "El valor que arroja es...")
self.Destroy()
if __name__ == "__main__":
app = wx.PySimpleApp()
Frame().Show()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment