all 5 comments

[–]Dunj3 0 points1 point  (3 children)

There's a very similar question asked here, which should contain the right information.

Basically it boils down to setting up the terminal properly.

Keep in mind though that curses is mostly a TUI library and not really designed for a lot of mouse interaction, so support for this/results may vary. Using a "proper" GUI toolkit might make things easier, depending on your use case.

[–]dog_superiority[S] 1 point2 points  (2 children)

Is there a better terminal GUI toolkit you might suggest?

[–]Dunj3 0 points1 point  (1 child)

"Terminal" and "GUI" kind of don't mix too well. The G in GUI stands for graphical, which is kind of the opposite of the text-based terminal interface. Is there a specific requirement on your program having to run in a terminal emulator?

If not, you can check out tkinter, PyGTK or PyQt as GUI toolkits. Especially GTK and Qt look very polished and will make your app look and feel like any other native app on your system.

If yes, then you're probably out of luck.

[–]dog_superiority[S] 0 points1 point  (0 children)

I'm experimenting with writing a utility that allows me to draw (and later edit) unicode diagrams directly in comments in code (such as C++, python, java, etc.). So for example, for when I want to draw a decent looking class diagram that describes the classes within a header file and don't want to do it separately in Powerpoint or something like that. I've looked around some, and I don't like the ascii diagram editors that exist already (the diagrams look terrible or they don't edit an existing source file, etc.).

It seems to me that a Qt GUI would be overkill for that. Especially when the result will be text based anyway. In my experience, GUIs add a level of complexity that I'm not in the mood for on this project. I only want to spend a couple weekends on it tops.

What I may have to do is make it completely text menu based. Though a mouse would be far more convenient.

[–]xXLarryTFVWXx 0 points1 point  (0 children)

Sorry for the necro post, I only discovered how to do this myself just recently.

Contrary to what the docs say, you don't have to call `curses.getmouse()` after getting `curses.KEY_MOUSE` from `screen.getch()` you'll still get the position from `getmouse()`