gtk custom spin button

我的未来我决定 提交于 2020-01-02 23:51:12

问题


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

  1. Is there 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.

回答1:


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.




回答2:


Perhaps you could use GtkCalendar?




回答3:


I wrote such a thing for myself:

https://github.com/ilius/starcal/blob/master/scal3/ui_gtk/mywidgets/multi_spin/date.py



来源:https://stackoverflow.com/questions/4404825/gtk-custom-spin-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!