Home > other >  [question] Linux programming python curses, screen size why the same?
[question] Linux programming python curses, screen size why the same?

Time:09-23

 import time 
The import curses
The from the curses import wrapper

Def screen_size_changed (screen) :
The count=0
While True:
Time. Sleep (1)
If the count & gt; 20:
Break
Count +=1

Num_rows, num_cols=screen. Getmaxyx ()
Print (" Rows: {}, Colums: {} ". The format (num_rows num_cols))

Curses. Endwin ()


If __name__=="__main__" :
Screen=curses. Initscr ()
Wrapper (screen_size_changed)


The function of the code above is every 1 s within the maximum size of the print the current screen (print will be a little messy, but not affect test result), you can simply try to change the window size you want, and get the size of the values are the same, is this why?
  • Related