0

I wrote simple function, and I can't figure out why it inputs letters twice. I was trying to change position of screen.refresh(), but the problem is, this screen isn't reloading, after choosing this function from menu.

def add_dish():
    screen.clear()
    screen.border('|', '|', '-', '-', '+', '+', '+', '+')
    screen.addstr(2, 50, "Add dish to catalog")
    screen.addstr(4, 4, "Dish: ")
    win = curses.newwin(1,30,4,10)
    box = Textbox(win)
    screen.refresh()
    box.edit()
    screen.getch()

Main function look like this (it's in polish, but it doesn't really matter)

def main():
    maxY, maxX = screen.getmaxyx()
    maxY = int(maxY)
    maxX = int(round(maxX))
    ticker = 3
    screen.clear()
    screen.border('|', '|', '-', '-', '+', '+', '+', '+')
    screen.addstr(2, 35, "Witaj w katalogu wyności, który przedstawi Ci potrawy i ich kalorie w 100g!")
    screen.addstr(3,50, "Poniej przedstawione są mozliwe opcje.")
    screen.addstr(6, 10, "1. Wyświetl zawartość katalogu")
    screen.addstr(7, 10, "2. Dodaj do katalogu")
    screen.addstr(8, 10, "3. Usuń z katalogu")
    screen.addstr(9, 10, "4. Znajdź i wyświetl dane danie")
    screen.addstr(10, 10, "5. Znajdź i wyświetl danie po wartości")
    screen.addstr(11, 10, "6. Zakończ działanie aplikacji")

    key = screen.getch()
    if key == ord("1"):
        wyswietl_katalog(ticker, maxY, maxX)
    elif key == ord("2"):
        add_dish()

    screen.refresh()
0x0uer
  • 69
  • 4

0 Answers0