Is it possible to change the date format used by wx.Calendar?
I.e. instead of using dd/mm/yyyy to use e.g. dd.mm.yyyy etc
Werner
Is it possible to change the date format used by wx.Calendar?
I.e. instead of using dd/mm/yyyy to use e.g. dd.mm.yyyy etc
Werner
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Is it possible to change the date format used by wx.Calendar?
I.e. instead of using dd/mm/yyyy to use e.g. dd.mm.yyyy etc
Werner
</div>
What exactly are you talking about? The format that is returned when you click on a date? If you're talking about setting the month and year, the demo has the following:
self.calend.SetMonth(start_month)
self.calend.SetYear(start_year)
I suspect that you mean something else though...
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
Hi Mike,
Mike Driscoll wrote:
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Is it possible to change the date format used by wx.Calendar?
I.e. instead of using dd/mm/yyyy to use e.g. dd.mm.yyyy etc
Werner
</div>
What exactly are you talking about? The format that is returned when you click on a date? If you're talking about setting the month and year, the demo has the following:
self.calend.SetMonth(start_month)
self.calend.SetYear(start_year)I suspect that you mean something else though...
I mean the display format of the date, as shown above I use "/" as a separator or ".", some countries also use "-" instead, and on top also the dd/mm/yyyy or mm/dd/yyyy or yyyy/mm/dd (all these with the different separators).
Initially I thought it picks it up from the Windows/System configuration, but changing my configuration does not seem to change anything. Preferably I would like to be able to set it from within my program, so I can run the system on a European machine, but still display US date formats and vis versa .......
Actually, would it be possible to use a wx.lib.masked control instead of the standard wx.textctrl. I guess that would mean to roll my own, i.e. copy the one from wx.lib.popupctrl to my own and change it, then I could just pass in the format to the masked control. Will give this a try during the next few days.
Werner
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Hi Mike,
Mike Driscoll wrote:
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Is it possible to change the date format used by wx.Calendar?
I.e. instead of using dd/mm/yyyy to use e.g. dd.mm.yyyy etc
Werner
</div>
What exactly are you talking about? The format that is returned when you click on a date? If you're talking about setting the month and year, the demo has the following:
self.calend.SetMonth(start_month)
self.calend.SetYear(start_year)I suspect that you mean something else though...
I mean the display format of the date, as shown above I use "/" as a separator or ".", some countries also use "-" instead, and on top also the dd/mm/yyyy or mm/dd/yyyy or yyyy/mm/dd (all these with the different separators).
Initially I thought it picks it up from the Windows/System configuration, but changing my configuration does not seem to change anything. Preferably I would like to be able to set it from within my program, so I can run the system on a European machine, but still display US date formats and vis versa .......
Actually, would it be possible to use a wx.lib.masked control instead of the standard wx.textctrl. I guess that would mean to roll my own, i.e. copy the one from wx.lib.popupctrl to my own and change it, then I could just pass in the format to the masked control. Will give this a try during the next few days.
Werner
I think there's some mis-communication going on. Looking at the demo, the Calendar and CalendarCtrl demos show a "real" calendar with the month and year above them. Maybe you're talking about the DatePickerCtrl? Still, I think I know what you're talking about. I'm pretty sure I read about this very issue earlier this year. It might have been this thread:
Mike
In the MaskedCtrlDemo, on the second panel, is one of these controls.
it shouldn't be too hard to put it in a popupctrl.
On Mon, Aug 11, 2008 at 7:22 AM, Werner F. Bruhin <werner.bruhin@free.fr> wrote:
I mean the display format of the date, as shown above I use "/" as a
separator or ".", some countries also use "-" instead, and on top also the
dd/mm/yyyy or mm/dd/yyyy or yyyy/mm/dd (all these with the different
separators).
Actually, would it be possible to use a wx.lib.masked control instead of the
standard wx.textctrl. I guess that would mean to roll my own, i.e. copy the
one from wx.lib.popupctrl to my own and change it, then I could just pass in
the format to the masked control. Will give this a try during the next few
days.
--
Josh English
Joshua.R.English@gmail.com
Mike Driscoll wrote:
...
I think there's some mis-communication going on. Looking at the demo, the Calendar and CalendarCtrl demos show a "real" calendar with the month and year above them.
I was looking/referring to the PopupControl demo which uses the CalendarControl.
Maybe you're talking about the DatePickerCtrl? Still, I think I know what you're talking about. I'm pretty sure I read about this very issue earlier this year. It might have been this thread:
Thanks for that pointer, I think DatePickerCtrl looks actually a bit nicer.
Werner
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll wrote:
...I think there's some mis-communication going on. Looking at the demo, the Calendar and CalendarCtrl demos show a "real" calendar with the month and year above them.
I was looking/referring to the PopupControl demo which uses the CalendarControl.
Oh. Duh! Sorry I was so dense. Looking at the code, all you'd need to do is change the OnCalSelected method to whatever format you needed.
'%02d/%02d/%04d' % (month, day, year)
'08/12/2008'
>>> '%02d.%02d.%04d' % (month, day, year)
'08.12.2008'
>>> '%02d.%02d.%04d' % (day, month, year)
'12.08.2008'
Maybe you're talking about the DatePickerCtrl? Still, I think I know what you're talking about. I'm pretty sure I read about this very issue earlier this year. It might have been this thread:
Thanks for that pointer, I think DatePickerCtrl looks actually a bit nicer.
Werner
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
Mike,
Mike Driscoll wrote:
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll wrote:
...I think there's some mis-communication going on. Looking at the demo, the Calendar and CalendarCtrl demos show a "real" calendar with the month and year above them.
I was looking/referring to the PopupControl demo which uses the CalendarControl.
Oh. Duh! Sorry I was so dense. Looking at the code, all you'd need to do is change the OnCalSelected method to whatever format you needed.
I noticed that too (and should have mentioned it then maybe the confusion would not have been caused in the first place), but wondered if there is not a way to tell the calendar control what to expect and what to return. I.e. I think I would need to handle the format in OnCalSelected and in FormatContent.
Will do some more testing with all this.
Thanks
Werner
Werner F. Bruhin wrote:
Mike,
Mike Driscoll wrote:
Werner F. Bruhin wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll wrote:
...I think there's some mis-communication going on. Looking at the demo, the Calendar and CalendarCtrl demos show a "real" calendar with the month and year above them.
I was looking/referring to the PopupControl demo which uses the CalendarControl.
Oh. Duh! Sorry I was so dense. Looking at the code, all you'd need to do is change the OnCalSelected method to whatever format you needed.
I noticed that too (and should have mentioned it then maybe the confusion would not have been caused in the first place), but wondered if there is not a way to tell the calendar control what to expect and what to return. I.e. I think I would need to handle the format in OnCalSelected and in FormatContent.
Will do some more testing with all this.
Thanks
Werner
There may well be, but I don't know what it is and since none of the other chaps have chipped in yet, my guess is that it's a "roll-your-own" thing.
Mike