Sep-21-2018, 08:20 PM
Hello,
the module 'npyscreen' has two widgets to pick dates ('DateCombo' and 'TitleDateCombo').
I was told that the python library 'urwid' does not have a date picker, which is due to the complexity.
Unfortunately I could not find such a third-party library.
Although there are projects like 'khal', these are mostly designed as stand-alone applications and not as 'urwid' widgets.
Does anyone know such a project?
If there is no such thing, with which approaches can this lack be compensated?
'urwid.Edit' (basically a text field) has the problem that invalid data can be entered. Although a conversion to 'datetime.date' and exception handling does the trick, this is very clunky.
Here is the 'npyscreen' date picker and the associated source code:
![[Image: hpkhL.png]](https://i.stack.imgur.com/hpkhL.png)
This question has also been posted on stackoverflow.
Best regards
AFoeee
the module 'npyscreen' has two widgets to pick dates ('DateCombo' and 'TitleDateCombo').
I was told that the python library 'urwid' does not have a date picker, which is due to the complexity.
Unfortunately I could not find such a third-party library.
Although there are projects like 'khal', these are mostly designed as stand-alone applications and not as 'urwid' widgets.
Does anyone know such a project?
If there is no such thing, with which approaches can this lack be compensated?
'urwid.Edit' (basically a text field) has the problem that invalid data can be entered. Although a conversion to 'datetime.date' and exception handling does the trick, this is very clunky.
Here is the 'npyscreen' date picker and the associated source code:
![[Image: hpkhL.png]](https://i.stack.imgur.com/hpkhL.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import npyscreen class DateForm(npyscreen.Form): def afterEditing( self ): self .parentApp.setNextForm( None ) def create( self ): self .date = self .add(npyscreen.TitleDateCombo, name = "Date" ) class TestApplication(npyscreen.NPSAppManaged): def onStart( self ): new_user = self .addForm( "MAIN" , DateForm, name = "Read Date" ) if __name__ = = "__main__" : TestApplication().run() |
Best regards
AFoeee