#1
  1. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0

    static part of the program


    Is it possible for me to make something "static" in a Python script? I.e. I would like to include a menu for my script always on the top of the screen:
    Code:
    [ M      E     N     U ]
    ------------------------
    | the place where
    | the script execu-
    | tes
    Is this possible? Thank you very much, and sorry if this has been answered before!
  2. #2
  3. chown python:users\ /world
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Texas Tech
    Posts
    95
    Rep Power
    15
    Is this a client side application or an internet application? Because I do not understand what you are trying to accomplish.
    Hartmann
    badice.com
  4. #3
  5. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Originally posted by Hartmann
    Is this a client side application or an internet application? Because I do not understand what you are trying to accomplish.
    It's a command line program, a telephone book. I'm trying to accomplish to have something like a header and a footer which wouldn't move as the script executes.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    14
    Code:
    def print_header():
         print """
    [ M      E     N     U ]
    ------------------------
    | the place where
    | the script execu-
    | tes"""
    
    def print_footer():
         print """
    Blah blah, footer string.
    Thanks for running print_footer()"""
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  8. #5
  9. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Strike, I don't think that would be the solution... I want the MENU part (in which I'd have the options: Add, Delete, Search, List, etc.) to ALWAYS be visible, no matter what.

    How can I accomplish that?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    14
    Originally posted by zweistein
    Strike, I don't think that would be the solution... I want the MENU part (in which I'd have the options: Add, Delete, Search, List, etc.) to ALWAYS be visible, no matter what.

    How can I accomplish that?
    Well, you either loop and print it every time, or you use a library like ncurses for console drawing. The former is easier for small things, but the latter is probably the technically "more correct" solution.
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  12. #7
  13. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Originally posted by Strike
    Well, you either loop and print it every time, or you use a library like ncurses for console drawing. The former is easier for small things, but the latter is probably the technically "more correct" solution.
    Yeah, but I need something for Windows... As I can see, the ncurses library doesn't work with win...
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    14
    Well, supposedly the simpler "curses" (not ncurses) library has a Windows version. But, Windows + console programming = not a great mix, in general.
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  16. #9
  17. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Originally posted by Strike
    Well, supposedly the simpler "curses" (not ncurses) library has a Windows version. But, Windows + console programming = not a great mix, in general.
    Great... any other ideas? (except installing Linux? ).
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    14
    Originally posted by zweistein
    Great... any other ideas? (except installing Linux? ).
    What's wrong with that one?

    Well, I said a few posts up that if you just had one main cycle, that you could just print the menu any time you made any modifications to the screen. It'd be sorta like graphics programming, you could have a "display" pseudo-callback that would always print the menu first and then whatever stuff is supposed to go after it .. after the menu.
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  20. #11
  21. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Originally posted by Strike
    What's wrong with that one?

    Well, I said a few posts up that if you just had one main cycle, that you could just print the menu any time you made any modifications to the screen. It'd be sorta like graphics programming, you could have a "display" pseudo-callback that would always print the menu first and then whatever stuff is supposed to go after it .. after the menu.
    I'll try that one... Thank you for your help!
  22. #12
  23. Will develop for food.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Croatia
    Posts
    14
    Rep Power
    0
    Hello.

    I found this which works as a replacement for the curses library in Windows.

    Thanks and cya!

IMN logo majestic logo threadwatch logo seochat tools logo