![]() |
how can I be informed when the date changes in python
Hi,
I'm writing a calendar widget for maemo5 using python something like datetoday-home-widget and I'm almost done. the only thing remained is that I don't know how to be informed when the date changes so I can redraw the widget. Does any body know how to implement it in python or any reference or sample code? |
Re: how can I be informed when the date changes in python
Perhaps setting an alarm at 00:00 for your app using python-alarm / libalarm could help?
http://wiki.maemo.org/Documentation/...larm_Framework (I have no clue if 100% of that is implemented inside python-alarm.) |
Re: how can I be informed when the date changes in python
Thanks for the reply
I found another way using signal module: Code:
signal.signal(signal.SIGALRM, lambda signum, frame: self.update_calendar()) |
Re: how can I be informed when the date changes in python
You can also use gobject.timeout_add and calculate the time until midnight like above. This will call the callback in GTK+ mainloop, which might be cleaner than using Unix signals (which can happen at any point during execution). (assuming you use GTK+ - there's surely a similiar mechanism in the Qt world)
|
Re: how can I be informed when the date changes in python
Thanks thp
I've just implemented it using gobject.timeout_add. And one more question. How can I be informed when user manually changes date? |
Re: how can I be informed when the date changes in python
I found the solution:
Code:
import dbus |
All times are GMT. The time now is 18:01. |
vBulletin® Version 3.8.8