gtk custom spin button
I want to make a gtk SpinButton, but for inputting dates.
- Is th开发者_运维知识库ere an easier way to input dates into GTK?
- If not, how can I create a SpinButton look-alike, but whose output is text representing dates instead of integers? Ideally I'd re-use the arrows, the clicks, the integration with the adjustment, etc. I really just need the output to look different, as I can even represent dates as integers.
The calendar is a bit large, but you can find code putting it in a popup. Personally I use a regular text entry and parse the date.
As for SpinButton, it is based on a text entry, so you might be able to modify its display only by fiddling with inherited signals and returning False. See also the update-policy and numeric properties.
Perhaps you could use GtkCalendar
?
I wrote such a thing for myself:
https://github.com/ilius/starcal/blob/master/scal3/ui_gtk/mywidgets/multi_spin/date.py
精彩评论