[pygtk] Port of a gtk date entry widget

Jakub Piotr Cłapa loc at toya.net.pl
Sun Dec 4 01:55:52 WST 2005


Fabian Sturm wrote:
> Hi!
> 
> I am currently trying to port the libgnomeui DateEntry widget to python,
> since I want to use it both on Linux and Win32.
> 
> So far everything worked out nicely.
> But due to the lack of a proper custom widget tutorial and my lack of
> gtk / gobject knowledge I just cooked something up on my own.
> 
> During this I stumbled on some things which I would like to clarify
> before I continue the porting.
> 
> 1. The custom widget uses it's own constants like
> (GNOME_DATE_EDIT_SHOW_TIME, and I tried to implement the with the
> following:
> 
> (GNOME_DATE_EDIT_SHOW_TIME, 
>  GNOME_DATE_EDIT_24_HR, 
>  GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY) = [1 << 0, 1 << 1, 1 << 2]
> 
> does this make sense? do I have to register them somewhere?

Looks quite good. Could be [1 << x for x in range (MAX_X)] also.

> 2. I can't hide any of the widgets. E.g. a call to
> self.__cal_label.hide() does not hide the label
> 
> 
> 3. The c version of the widget had two different constructors, as far as
> I understood is this impossible in python, so how do you cope with it.

You add keyword arguments to __init__ and check them on runtime or (my 
own idea; not sure if it's Harmful(TM)) add a class method returning an 
instance.

-- 
Regards,
Jakub Piotr Cłapa


More information about the pygtk mailing list