[Tutor] Gtk time control and Glade
Chris Fuller
cfuller084 at thinkingplanet.net
Tue Mar 17 15:58:39 CET 2009
Make your own. You can have empty containers in glade that you fill in at
runtime, or you could create the interface in glade, perhaps a couple of
ComboBoxes. I would leave an empty container and create a reusable widget
descended from gtk.HBox that implements validation or anything else that it
would need to do. Maybe it could default to the current time, for instance.
I know its possible to configure glade to use custom widgets, but I've never
bothered to learn about since it's so easy (and free of caveats that I might
become subject to) to leave empty space for runtime use.
Here's a quick and dirty (and untested!) example:
class TimeEntry(gtk.HBox):
def __init__(self):
gtk.HBox.__init__(self)
self.hr = \
w = gtk.ComboBox()
for i in range(24):
w.append_text('%02d'%(i,))
self.pack_start(w, False, False, 0)
w.show()
w = gtk.Label(':')
self.pack_start(w, False, False, 0)
w.show()
self.min = \
w = gtk.ComboBox()
for i in range(60):
w.append_text('%02d'%(i,))
self.pack_start(w, False, False, 0)
w.show()
def get(self):
return '%02d:%02d' % (self.hr.get_active(),self.min.get_active())
Cheers
On Tuesday 17 March 2009 09:25, Robert Berman wrote:
> I am writing a Blood-Glucose Analysis application for Diabetics. I am
> using Python 2.5 under Ubuntu 8.10 and Glade 3.4.5.
>
> Manually recorded test results require a calendar control for the date
> of the test (no problem) and a timer control for the time of the
> test(big problem). While Glade certainly supports a calender control
> with a great deal of documentation, there is not an available time
> control for Glade. Nor was I able to find a general time control for
> Gtk. I did find one for wxwidgets but I am not using wxwidgets nor am I
> using PyQt.
>
> I am reasonably sure such a control exists. I know I'm not the only
> individual who needs date and time controls. But, using Google has
> provided all kinds of information, there has not been a specific
> statement about any specific controls. At this time I do not feel I have
> the level of expertise to build my own control and it is something I
> would rather not have to do.
>
> Have any of you heard of such an available time control specifically for
> Gtk and available or capable of being used by Glade.
>
> Thank you for any insights and suggestions.
>
>
> Robert Berman
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list