I'm writing a program in python curses, I just wanted to prevent curses crashing with terminal resizing so I was wondering if there is a way to lock terminal size to 80x24.
Asked
Active
Viewed 251 times
0
-
3Even if there was a way (I doubt it is, but don't know), you can't enforce this - I use whatever terminal I want to run your program. So the correct cause of action is to deal with it: http://stackoverflow.com/questions/5161552/python-curses-handling-window-terminal-resize – deets Jun 12 '15 at 14:19
-
I could create a launcher which launches the program in the terminal i want. – Alessio Ragno Jun 12 '15 at 14:28
-
1Is it curses that is crashing, or your code? – Peter Wood Jun 12 '15 at 14:29
-
What happens is that if i have a long string and i make the terminal smaller the string curses returns error: `error: addstr() returned ERR` – Alessio Ragno Jun 12 '15 at 14:38
-
@AlessioRagno I don't have that terminal you want installed, so your launcher crashes - square one. Honestly: if you force me to use 80x25 terminal windows on my 27" screen, I'm annoyed. If you force me to use a 140x80 terminal window on my netbook, I'm also annoyed. Accept reality - we live in a day and age of resizable terminals. Since roundabout the 90ies.... – deets Jun 12 '15 at 15:02
-
@AlessioRagno the documentation of curses is somewhat lacking, but some experimentation shows that addstr will in fact fail if the str exceeds the limits of the surface you draw to. But in the end this is to be expected, you need to adapt your rendering to a smaller size (or display an error-message at least that says "sorry, can't run in small terminals") – deets Jun 12 '15 at 15:47
-
1possible duplicate of [Prevent Terminal resize python curses](http://stackoverflow.com/questions/30571686/prevent-terminal-resize-python-curses) – Jay Bosamiya Jun 12 '15 at 17:46
-
It is certainly a duplicate, and OP is unlikely to get a better answer. – Thomas Dickey Jun 12 '15 at 19:59
-
The program is for a chain of laundries so they dont have to care about the size, and if they want to make the term bigger they could press Ctrl +. – Alessio Ragno Jun 13 '15 at 15:59
-
It is not a copy, in the other question i wanted to address to programmers who use curses, here I am talking about terminal. – Alessio Ragno Jun 13 '15 at 16:00