bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.23k stars 54 forks source link

AttributeError: module 'signal' has no attribute 'SIGWINCH' #1

Closed fun840 closed 2 years ago

fun840 commented 2 years ago

This module looks really cool, but running the example program (the one from README.md) gives the error,

AttributeError: module 'signal' has no attribute 'SIGWINCH'

I'm on Windows, which seems like it could be related, but README.md says it supports windows. Any ideas? TIA!

fun840 commented 2 years ago

I did some more googling, and found this StackOverflow answer and this github issue for Windows Terminal, I don't really know anything about the structure of the module but it seems implementable.

bczsalba commented 2 years ago

Hey! Windows support currently is very hit or miss, there's some quirks of the system I have to get around.

I currently don't have a Windows machine on me, but once I do I'll implement it.

As a note, I'm fairly certain at least one of the example programs is broken since they were written for an essentially different API. Once 1.0.0 is released I will update them and add some more.

Thank you for your interest!

bczsalba commented 2 years ago

I couldn't figure out an alternative for SIGWINCH on Windows, so for the time being resize events are unhandled on the platform. Thank you for the issue!

fun840 commented 2 years ago

Though I'm not really sure how good of a practice it is, it is (probably) possible to start a thread that runs in the background and checks every 0.01 seconds or something if the window size has changed, then calls __update_size()

bczsalba commented 2 years ago

Yeah, that is definitely something I could do sometime later on. WindowManager already runs a separate thread for some actions, so it really shouldn't be that much of a bother.

Fun fact: I think the method you're suggesting is actually what I was using a couple months back, before all the SIGWINCH things were added. Funny how things are with windows sometimes, eh?

It also turns out that this issue was not really fixed, according to this comment, but some new commits should have fixed it properly now.

Reopening until I can confirm it was fixed.

bczsalba commented 2 years ago

So according to #6, this should be fixed now.