Python Forum
[Solved]Return values from npyscreen
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved]Return values from npyscreen
#1
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.
Reply
#2
Have you tried date.value and AmPm.value ? Also there is a whole example application in npyscreen's documentation.
Reply
#3
Thanks a lot. That's what I was looking for.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to return 2 values from 1 DF that equals another DF cubangt 5 650 Oct-21-2023, 02:45 PM
Last Post: deanhystad
  Loop through json file and reset values [SOLVED] AlphaInc 2 2,151 Apr-06-2023, 11:15 AM
Last Post: AlphaInc
  Parallelism with return values Plexian 7 1,514 Aug-14-2022, 09:33 AM
Last Post: Plexian
  Help with passing values in npyscreen Extra 8 2,551 May-21-2022, 12:41 AM
Last Post: Extra
  please help with classes and return values jamie_01 5 1,812 Jan-17-2022, 02:11 AM
Last Post: menator01
  Need to parse a list of boolean columns inside a list and return true values Python84 4 2,125 Jan-09-2022, 02:39 AM
Last Post: Python84
  Function - Return multiple values tester_V 10 4,473 Jun-02-2021, 05:34 AM
Last Post: tester_V
  [SOLVED] [geopy] "ValueError: too many values to unpack (expected 2)" Winfried 2 2,881 Mar-30-2021, 07:01 PM
Last Post: Winfried
  Function to return list of all the INDEX values of a defined ndarray? pjfarley3 2 1,978 Jul-10-2020, 04:51 AM
Last Post: pjfarley3
  What is the best way to return these 4 integer values? Pedroski55 4 2,561 Apr-13-2020, 09:54 PM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020