Python Forum

Full Version: [Solved]Return values from npyscreen
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have this code:
import npyscreen

class TestApp(npyscreen.NPSApp):
    def main(self):
        frame  = npyscreen.Form(name = "Set Reminder",)
        date = frame.add(npyscreen.TitleDateCombo, name = "Date:")
        AmPm  = frame.add(npyscreen.TitleText, name = "AM/PM:",)
        time = frame.add(npyscreen.TitleSelectOne, max_height=5, value = [1,], name="Choose a Time",
                values = ["8:00","8:30", "9:00","9:30","10:00","10:30"
                        ,"11:00","11:30","12:00","12:30","1:00","1:30"
                        ,"2:00","2:30","3:00","3:30","4:00","4:30","5:00"
                        ,"5:30","6:00","6:30","7:00","7:30"], scroll_exit=True)


        # This lets the user interact with the Form.
        frame.edit()
        print(time.get_selected_objects())

App = TestApp()
App.run()
And I want to return/print the: date & AmPm variables.
How do I get those values, so I can print them to the terminal?

Thanks in advance.
Have you tried date.value and AmPm.value ? Also there is a whole example application in npyscreen's documentation.
Thanks a lot. That's what I was looking for.