gtk custom spin button

2019-06-05 04:34发布

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.

3条回答
唯我独甜
2楼-- · 2019-06-05 04:51

Perhaps you could use GtkCalendar?

查看更多
时光不老,我们不散
3楼-- · 2019-06-05 05:02

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.

查看更多
登录 后发表回答