开发者

gtk custom spin button

开发者 https://www.devze.com 2023-01-30 08:55 出处:网络
I want to make a gtk SpinButton, but for inputting dates. Is th开发者_运维知识库ere an easier way to input dates into GTK?

I want to make a gtk SpinButton, but for inputting dates.

  1. Is th开发者_运维知识库ere an easier way to input dates into GTK?
  2. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号