Hello, i need a widget for selecting a date. Just an Entry to manually
edit a date and a Button to pop up a calendar widget. 

I have found that the libgnomeui has a widget like that, the
Gnome-DateEdit widget, but the application must run on Windows as well
and i can't find any port to Windows for libgnomeui (unfortunately i
don't have access to a Windows machine to try to build the code myself,
i've notice on the changelog that a port to win32 is going on). 

I started looking at the C source code of the Gnome-DateEdit widget, and
didn't find anything but pure gtk functions, so i'm trying to write it
myself purely on python.

The problem i'm having is on the calendar popup, it is a popup window,
with the calendar widget on it, when the button is pressed, it display
the window just below the button position and grab the calendar window.
The button_press_event signal is connected to the calendar window, so i
can hide it if a button is pressed anywhere on the screen but the
calendar window.

To do that on C, they use the gtk_get_event_widget function for getting
the widget that recibe the button_press_event an compare it with the
calendar window.

This is the code in C:

static gint
button_press_popup (GtkWidget *widget, GdkEventButton *event, gpointer
data)
{
        GnomeDateEdit *gde;
        GtkWidget *child;

        gde = data;

        child = gtk_get_event_widget ((GdkEvent *) event);

        if (child != widget) {
                while (child) {
                        if (child == widget)
                        return FALSE;
                child = child->parent;
                }
        }

        hide_popup (gde);

        return TRUE;
}


The problem is i can't find this function on pygtk. It is posible to do
it this this way? or is anything easier for that?.

The rest of it works fine so far, the calendar window appears where it's
supposed to, when i double click some day, the window hides, if i press
Esc also hides (as expected), but otherwise, the whole system gets
blocks (because of the grab).

Thanks in advance

Paulo Richards

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to