calendar year, month, day

I'd like to pre-set attributes for certain dates on a calendar. It
seems that wx.calendar only takes a list of days for a certain month.
How may I add a year in this process. For example, I need to make
8/12/2006, 3/18/2007, and 6/29/2008 selected (or any other methods
that can make these dates separated from other dates) when the
calendar is initialized. Please advise. Thanks.

I’m probably wrong, but maybe you could put a checking function to be
called on events that show the calendar changing, and then use
.GetYearControl() to get the currently shown year and .GetMonthControl()

to get the month, then do an if statement to check if they are
the month/year you want, and then if so you can then use SetAttr().
(I am also confused as to why there is not a SetAttr method that takes
a year, month, and day argument).

Che

···

On Mon, Aug 10, 2009 at 9:53 PM, prairie99 prairie99@gmail.com wrote:

I’d like to pre-set attributes for certain dates on a calendar. It

seems that wx.calendar only takes a list of days for a certain month.

How may I add a year in this process. For example, I need to make

8/12/2006, 3/18/2007, and 6/29/2008 selected (or any other methods

that can make these dates separated from other dates) when the

calendar is initialized. Please advise. Thanks.

Che,

Thank you so much for your helpful instruction. I will follow this
procedure to do my little app. I was chasing something like a nested
dictionary, but it didn't work out. Just like you said, I hope there
is an easy way of doing this like providing a year argument.

C M wrote:

    I'd like to pre-set attributes for certain dates on a calendar. It
    seems that wx.calendar only takes a list of days for a certain month.
    How may I add a year in this process. For example, I need to make
    8/12/2006, 3/18/2007, and 6/29/2008 selected (or any other methods
    that can make these dates separated from other dates) when the
    calendar is initialized. Please advise. Thanks.

I'm probably wrong, but maybe you could put a checking function to be
called on events that show the calendar changing, and then use
.GetYearControl() to get the currently shown year and .GetMonthControl()
to get the month, then do an if statement to check if they are
the month/year you want, and then if so you can then use SetAttr().
(I am also confused as to why there is not a SetAttr method that takes
a year, month, and day argument).

I think it's by design. The CalendarCtrl is meant to be a one month at a time kind of widget, and so it does not require you to pre-load it with all the holidays and other attributes for all of eternity. Instead it allows you to set the daily attributes you want in an on-demand basis.

···

On Mon, Aug 10, 2009 at 9:53 PM, prairie99 <prairie99@gmail.com > <mailto:prairie99@gmail.com>> wrote:

--
Robin Dunn
Software Craftsman

Thanks Robin. I am not very familiar with GetYearControl or
GetMonthControl methods. They return "Control". Would you one or two
lines of sample codes? Thanks!

···

On Aug 11, 2:35 pm, Robin Dunn <ro...@alldunn.com> wrote:

C M wrote:

> On Mon, Aug 10, 2009 at 9:53 PM, prairie99 <prairi...@gmail.com > > <mailto:prairi…@gmail.com>> wrote:

> I'd like to pre-set attributes for certain dates on a calendar. It
> seems that wx.calendar only takes a list of days for a certain month.
> How may I add a year in this process. For example, I need to make
> 8/12/2006, 3/18/2007, and 6/29/2008 selected (or any other methods
> that can make these dates separated from other dates) when the
> calendar is initialized. Please advise. Thanks.

> I'm probably wrong, but maybe you could put a checking function to be
> called on events that show the calendar changing, and then use
> .GetYearControl() to get the currently shown year and .GetMonthControl()
> to get the month, then do an if statement to check if they are
> the month/year you want, and then if so you can then use SetAttr().
> (I am also confused as to why there is not a SetAttr method that takes
> a year, month, and day argument).

I think it's by design. The CalendarCtrl is meant to be a one month at
a time kind of widget, and so it does not require you to pre-load it
with all the holidays and other attributes for all of eternity. Instead
it allows you to set the daily attributes you want in an on-demand basis.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org- Hide quoted text -

- Show quoted text -

prairie99 wrote:

Thanks Robin. I am not very familiar with GetYearControl or
GetMonthControl methods. They return "Control". Would you one or two
lines of sample codes? Thanks!

I wouldn't use that approach as those methods are only valid with the generic calendar control when it is not using the
CAL_SEQUENTIAL_MONTH_SELECTION style. Instead just catch the calendar events and get the current date from the event and see if the month or year has changed since the last time you checked. If so then set the new attributes as needed.

···

--
Robin Dunn
Software Craftsman