51 lines
1.2 KiB
Python
Executable File
51 lines
1.2 KiB
Python
Executable File
import curses
|
|
from curses.textpad import Textbox, rectangle
|
|
point = {'x': 0, 'y': 0}
|
|
dim={'h':20,'w':25}
|
|
nome=""
|
|
def new_point(x, y):
|
|
point['x'] = x
|
|
point['y'] = y
|
|
|
|
|
|
def main(main_screen):
|
|
|
|
# inizializza curses
|
|
screen = curses.initscr()
|
|
|
|
# abilitazione dei colori
|
|
curses.start_color()
|
|
|
|
# Imposta i colori
|
|
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_RED)
|
|
curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_RED)
|
|
|
|
# Creazione di una finestra
|
|
win = curses.newwin(dim['h'], dim['w'], point['x'], point['y'])
|
|
win.box()
|
|
# Imposta l'ombreggiatura grigia
|
|
win.bkgd(' ', curses.color_pair(2))
|
|
|
|
# Imposta il colore del testo
|
|
win.attron(curses.color_pair(1))
|
|
|
|
# Stampa del testo "Inserisci un messaggio:"
|
|
win.addstr(1, 1, "Intro:")
|
|
win.addstr(3, 1, "luca")
|
|
win.addstr(4, 1, "Mustacchio")
|
|
win.addstr(6, 1, "dai un nome al")
|
|
win.addstr(7, 1, " tuo personaggio:")
|
|
editwin = curses.newwin(1, 10, 8, 1)
|
|
textbox = Textbox(editwin)
|
|
curses.curs_set(1)
|
|
win.refresh()
|
|
screen.refresh()
|
|
textbox.edit()
|
|
# Attesa di un input per chiudere il programma
|
|
#screen.getch()
|
|
|
|
# Fine della modalità Curses
|
|
curses.endwin()
|
|
global nome
|
|
nome= textbox.gather()
|