Does the python library “urwid” contain a widget for reading in dates (datepicker)?












1















npyscreen has the widgets "DateCombo" and "TitleDateCombo" for picking dates.



Is there anything similar in urwid?
If not, are there any recommended third-party libraries?



Here is an example which uses npyscreen:



enter image description here



#! /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()









share|improve this question




















  • 2





    As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

    – abarnert
    Sep 9 '18 at 22:35
















1















npyscreen has the widgets "DateCombo" and "TitleDateCombo" for picking dates.



Is there anything similar in urwid?
If not, are there any recommended third-party libraries?



Here is an example which uses npyscreen:



enter image description here



#! /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()









share|improve this question




















  • 2





    As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

    – abarnert
    Sep 9 '18 at 22:35














1












1








1








npyscreen has the widgets "DateCombo" and "TitleDateCombo" for picking dates.



Is there anything similar in urwid?
If not, are there any recommended third-party libraries?



Here is an example which uses npyscreen:



enter image description here



#! /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()









share|improve this question
















npyscreen has the widgets "DateCombo" and "TitleDateCombo" for picking dates.



Is there anything similar in urwid?
If not, are there any recommended third-party libraries?



Here is an example which uses npyscreen:



enter image description here



#! /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()






python datepicker widget urwid tui






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 10 '18 at 16:16







AFoeee

















asked Sep 9 '18 at 22:22









AFoeeeAFoeee

19110




19110








  • 2





    As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

    – abarnert
    Sep 9 '18 at 22:35














  • 2





    As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

    – abarnert
    Sep 9 '18 at 22:35








2




2





As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

– abarnert
Sep 9 '18 at 22:35





As far as I know, urwid doesn't have a date picker. There are tons of urwid addon libraries (you can find many of them by searching PyPI for 'urwid'), most of which are a grab-bag of a bunch of unrelated things, so you probably have to read each project's description or homepage to see if any of them have what you want. If not, you'd have to write one yourself.

– abarnert
Sep 9 '18 at 22:35












2 Answers
2






active

oldest

votes


















1














No, urwid doesn't have a datepicker, it's a complex widget to implement which deserves its own project, since these widgets usually need to take into consideration date format, locale, etc.



I don't know any urwid library that implements it and couldn't find any by scanning quickly the ones I know.



You can try to shop for a library, but you might have better luck implementing one yourself with your specific needs.






share|improve this answer



















  • 1





    In the meantime I have written a rudimentary one (python3). For additional information see my answer.

    – AFoeee
    Nov 19 '18 at 14:22



















1














It seems that the python library urwid does not include a date picker (state of 2018). Therefore I wrote a (rudimentary) one.



The class is called additional_urwid_widgets.DatePicker and can be installed via pip.



Demonstration of date picker #1Demonstration of date picker #2





For a stand alone example, which illustrates the functionality of the widget, see here.



For more (and simpler) examples, see here.



For a more detailed explanation of the parameters and options, see the corresponding github wiki entry.








Some Examples



Minimal



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

dp = DatePicker(highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Minimal'






Not Today



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

not_today = datetime.date(2018, 2, 20)

dp = DatePicker(initial_date=not_today,
highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Not today'






ISO-8601 + Styled + Compact



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("dp_barActive_focus", "light gray", ""),
("dp_barActive_offFocus", "black", ""),
("dp_barInactive_focus", "dark gray", ""),
("dp_barInactive_offFocus", "black", ""),
("dp_highlight_focus", "black", "brown", "standout"),
("dp_highlight_offFocus", "white", "black")]

dp = DatePicker(month_names=[str(i).zfill(2) for i in range(13)],
day_format=[DatePicker.DAY_FORMAT.DAY_OF_MONTH_TWO_DIGIT],
columns=((6, DatePicker.PICKER.YEAR), (4, DatePicker.PICKER.MONTH), (4, DatePicker.PICKER.DAY)),
min_width_each_picker=4,
space_between=1,
topBar_endCovered_prop=("ᐃ", "dp_barActive_focus", "dp_barActive_offFocus"),
topBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
bottomBar_endCovered_prop=("ᐁ", "dp_barActive_focus", "dp_barActive_offFocus"),
bottomBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
highlight_prop=("dp_highlight_focus", "dp_highlight_offFocus"))

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'ISO-8601 + Styled + Compact'






share|improve this answer


























  • bravooo!! :clap: :clap: :clap! :)

    – elias
    Nov 19 '18 at 14:34











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52249082%2fdoes-the-python-library-urwid-contain-a-widget-for-reading-in-dates-datepicke%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














No, urwid doesn't have a datepicker, it's a complex widget to implement which deserves its own project, since these widgets usually need to take into consideration date format, locale, etc.



I don't know any urwid library that implements it and couldn't find any by scanning quickly the ones I know.



You can try to shop for a library, but you might have better luck implementing one yourself with your specific needs.






share|improve this answer



















  • 1





    In the meantime I have written a rudimentary one (python3). For additional information see my answer.

    – AFoeee
    Nov 19 '18 at 14:22
















1














No, urwid doesn't have a datepicker, it's a complex widget to implement which deserves its own project, since these widgets usually need to take into consideration date format, locale, etc.



I don't know any urwid library that implements it and couldn't find any by scanning quickly the ones I know.



You can try to shop for a library, but you might have better luck implementing one yourself with your specific needs.






share|improve this answer



















  • 1





    In the meantime I have written a rudimentary one (python3). For additional information see my answer.

    – AFoeee
    Nov 19 '18 at 14:22














1












1








1







No, urwid doesn't have a datepicker, it's a complex widget to implement which deserves its own project, since these widgets usually need to take into consideration date format, locale, etc.



I don't know any urwid library that implements it and couldn't find any by scanning quickly the ones I know.



You can try to shop for a library, but you might have better luck implementing one yourself with your specific needs.






share|improve this answer













No, urwid doesn't have a datepicker, it's a complex widget to implement which deserves its own project, since these widgets usually need to take into consideration date format, locale, etc.



I don't know any urwid library that implements it and couldn't find any by scanning quickly the ones I know.



You can try to shop for a library, but you might have better luck implementing one yourself with your specific needs.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 10 '18 at 16:54









eliaselias

13.9k84781




13.9k84781








  • 1





    In the meantime I have written a rudimentary one (python3). For additional information see my answer.

    – AFoeee
    Nov 19 '18 at 14:22














  • 1





    In the meantime I have written a rudimentary one (python3). For additional information see my answer.

    – AFoeee
    Nov 19 '18 at 14:22








1




1





In the meantime I have written a rudimentary one (python3). For additional information see my answer.

– AFoeee
Nov 19 '18 at 14:22





In the meantime I have written a rudimentary one (python3). For additional information see my answer.

– AFoeee
Nov 19 '18 at 14:22













1














It seems that the python library urwid does not include a date picker (state of 2018). Therefore I wrote a (rudimentary) one.



The class is called additional_urwid_widgets.DatePicker and can be installed via pip.



Demonstration of date picker #1Demonstration of date picker #2





For a stand alone example, which illustrates the functionality of the widget, see here.



For more (and simpler) examples, see here.



For a more detailed explanation of the parameters and options, see the corresponding github wiki entry.








Some Examples



Minimal



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

dp = DatePicker(highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Minimal'






Not Today



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

not_today = datetime.date(2018, 2, 20)

dp = DatePicker(initial_date=not_today,
highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Not today'






ISO-8601 + Styled + Compact



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("dp_barActive_focus", "light gray", ""),
("dp_barActive_offFocus", "black", ""),
("dp_barInactive_focus", "dark gray", ""),
("dp_barInactive_offFocus", "black", ""),
("dp_highlight_focus", "black", "brown", "standout"),
("dp_highlight_offFocus", "white", "black")]

dp = DatePicker(month_names=[str(i).zfill(2) for i in range(13)],
day_format=[DatePicker.DAY_FORMAT.DAY_OF_MONTH_TWO_DIGIT],
columns=((6, DatePicker.PICKER.YEAR), (4, DatePicker.PICKER.MONTH), (4, DatePicker.PICKER.DAY)),
min_width_each_picker=4,
space_between=1,
topBar_endCovered_prop=("ᐃ", "dp_barActive_focus", "dp_barActive_offFocus"),
topBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
bottomBar_endCovered_prop=("ᐁ", "dp_barActive_focus", "dp_barActive_offFocus"),
bottomBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
highlight_prop=("dp_highlight_focus", "dp_highlight_offFocus"))

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'ISO-8601 + Styled + Compact'






share|improve this answer


























  • bravooo!! :clap: :clap: :clap! :)

    – elias
    Nov 19 '18 at 14:34
















1














It seems that the python library urwid does not include a date picker (state of 2018). Therefore I wrote a (rudimentary) one.



The class is called additional_urwid_widgets.DatePicker and can be installed via pip.



Demonstration of date picker #1Demonstration of date picker #2





For a stand alone example, which illustrates the functionality of the widget, see here.



For more (and simpler) examples, see here.



For a more detailed explanation of the parameters and options, see the corresponding github wiki entry.








Some Examples



Minimal



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

dp = DatePicker(highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Minimal'






Not Today



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

not_today = datetime.date(2018, 2, 20)

dp = DatePicker(initial_date=not_today,
highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Not today'






ISO-8601 + Styled + Compact



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("dp_barActive_focus", "light gray", ""),
("dp_barActive_offFocus", "black", ""),
("dp_barInactive_focus", "dark gray", ""),
("dp_barInactive_offFocus", "black", ""),
("dp_highlight_focus", "black", "brown", "standout"),
("dp_highlight_offFocus", "white", "black")]

dp = DatePicker(month_names=[str(i).zfill(2) for i in range(13)],
day_format=[DatePicker.DAY_FORMAT.DAY_OF_MONTH_TWO_DIGIT],
columns=((6, DatePicker.PICKER.YEAR), (4, DatePicker.PICKER.MONTH), (4, DatePicker.PICKER.DAY)),
min_width_each_picker=4,
space_between=1,
topBar_endCovered_prop=("ᐃ", "dp_barActive_focus", "dp_barActive_offFocus"),
topBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
bottomBar_endCovered_prop=("ᐁ", "dp_barActive_focus", "dp_barActive_offFocus"),
bottomBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
highlight_prop=("dp_highlight_focus", "dp_highlight_offFocus"))

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'ISO-8601 + Styled + Compact'






share|improve this answer


























  • bravooo!! :clap: :clap: :clap! :)

    – elias
    Nov 19 '18 at 14:34














1












1








1







It seems that the python library urwid does not include a date picker (state of 2018). Therefore I wrote a (rudimentary) one.



The class is called additional_urwid_widgets.DatePicker and can be installed via pip.



Demonstration of date picker #1Demonstration of date picker #2





For a stand alone example, which illustrates the functionality of the widget, see here.



For more (and simpler) examples, see here.



For a more detailed explanation of the parameters and options, see the corresponding github wiki entry.








Some Examples



Minimal



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

dp = DatePicker(highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Minimal'






Not Today



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

not_today = datetime.date(2018, 2, 20)

dp = DatePicker(initial_date=not_today,
highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Not today'






ISO-8601 + Styled + Compact



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("dp_barActive_focus", "light gray", ""),
("dp_barActive_offFocus", "black", ""),
("dp_barInactive_focus", "dark gray", ""),
("dp_barInactive_offFocus", "black", ""),
("dp_highlight_focus", "black", "brown", "standout"),
("dp_highlight_offFocus", "white", "black")]

dp = DatePicker(month_names=[str(i).zfill(2) for i in range(13)],
day_format=[DatePicker.DAY_FORMAT.DAY_OF_MONTH_TWO_DIGIT],
columns=((6, DatePicker.PICKER.YEAR), (4, DatePicker.PICKER.MONTH), (4, DatePicker.PICKER.DAY)),
min_width_each_picker=4,
space_between=1,
topBar_endCovered_prop=("ᐃ", "dp_barActive_focus", "dp_barActive_offFocus"),
topBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
bottomBar_endCovered_prop=("ᐁ", "dp_barActive_focus", "dp_barActive_offFocus"),
bottomBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
highlight_prop=("dp_highlight_focus", "dp_highlight_offFocus"))

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'ISO-8601 + Styled + Compact'






share|improve this answer















It seems that the python library urwid does not include a date picker (state of 2018). Therefore I wrote a (rudimentary) one.



The class is called additional_urwid_widgets.DatePicker and can be installed via pip.



Demonstration of date picker #1Demonstration of date picker #2





For a stand alone example, which illustrates the functionality of the widget, see here.



For more (and simpler) examples, see here.



For a more detailed explanation of the parameters and options, see the corresponding github wiki entry.








Some Examples



Minimal



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

dp = DatePicker(highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Minimal'






Not Today



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import datetime
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("reveal_focus", "black", "white")]

not_today = datetime.date(2018, 2, 20)

dp = DatePicker(initial_date=not_today,
highlight_prop=("reveal_focus", None)) # By default, the focused picker is not highlighted!

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'Not today'






ISO-8601 + Styled + Compact



#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import calendar
from additional_urwid_widgets import DatePicker, MODIFIER_KEY # installed via pip
import urwid # installed via pip

# Color schemes that specify the appearance off focus and on focus.
PALETTE = [("dp_barActive_focus", "light gray", ""),
("dp_barActive_offFocus", "black", ""),
("dp_barInactive_focus", "dark gray", ""),
("dp_barInactive_offFocus", "black", ""),
("dp_highlight_focus", "black", "brown", "standout"),
("dp_highlight_offFocus", "white", "black")]

dp = DatePicker(month_names=[str(i).zfill(2) for i in range(13)],
day_format=[DatePicker.DAY_FORMAT.DAY_OF_MONTH_TWO_DIGIT],
columns=((6, DatePicker.PICKER.YEAR), (4, DatePicker.PICKER.MONTH), (4, DatePicker.PICKER.DAY)),
min_width_each_picker=4,
space_between=1,
topBar_endCovered_prop=("ᐃ", "dp_barActive_focus", "dp_barActive_offFocus"),
topBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
bottomBar_endCovered_prop=("ᐁ", "dp_barActive_focus", "dp_barActive_offFocus"),
bottomBar_endExposed_prop=("───", "dp_barInactive_focus", "dp_barInactive_offFocus"),
highlight_prop=("dp_highlight_focus", "dp_highlight_offFocus"))

pile = urwid.Pile([urwid.Text("press additionally the key modifier (default is 'ctrl')."),
urwid.Divider(" "),
dp])

loop = urwid.MainLoop(urwid.Filler(pile, "top"),
PALETTE)
loop.run()


Demonstration of example 'ISO-8601 + Styled + Compact'







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 14:37

























answered Nov 18 '18 at 20:18









AFoeeeAFoeee

19110




19110













  • bravooo!! :clap: :clap: :clap! :)

    – elias
    Nov 19 '18 at 14:34



















  • bravooo!! :clap: :clap: :clap! :)

    – elias
    Nov 19 '18 at 14:34

















bravooo!! :clap: :clap: :clap! :)

– elias
Nov 19 '18 at 14:34





bravooo!! :clap: :clap: :clap! :)

– elias
Nov 19 '18 at 14:34


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52249082%2fdoes-the-python-library-urwid-contain-a-widget-for-reading-in-dates-datepicke%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings