Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
i'm working on a project and I'm doing it in python with curses. seems cool so far. it tells me when the terminal size changes and I can write text to the screen and handle input. I'm not having too much trouble finding documentation/examples.

should I be using some other bullshit? curses is available on the host I'm working with (sdf dot org) and I assume its available on a wide variety of platforms so it seems natural to me.

also is it normal to wrap the write function so it doesn't crash the program every time you accidentally write outside the screen buffer

Adbot
ADBOT LOVES YOU

Best Bi Geek Squid
Mar 25, 2016
I hosed around with curses for some roguelike projects

it’s kinda of a pita. wrapping most of it in a function to cleanly exit on an exception or something without loving your terminal up is pretty normal I think

Best Bi Geek Squid
Mar 25, 2016
also the y, x coordinate convention is stupid

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I learned you can type stty sane ^J to unfuck the terminal

Archduke Frantz Fanon
Sep 7, 2004

using python is enough of a curse xD

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I like python. first love I guess

Best Bi Geek Squid
Mar 25, 2016

Silver Alicorn posted:

I learned you can type stty sane ^J to unfuck the terminal

huh TIL

mediaphage
Mar 22, 2007

Excuse me, pardon me, sheer perfection coming through
i think u need to talk to a computer witch

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
hm. I know one of those on co host

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

im programming a curse on you right now

Best Bi Geek Squid
Mar 25, 2016
curses is one of those libraries that makes you think “oh drat, I could do a whole aesthetic in this. why did computers ever evolve guis?” and then “I want to kill myself” like 5 mins later

Cybernetic Vermin
Apr 18, 2005

i like rich for just easily prettying up a program: https://github.com/Textualize/rich

the sister project textual is something to have seen once, but rather a step too far for any need i've ever had: https://github.com/Textualize/textual

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


love a good tui, lazygit and k9s being examples of stuff i use at work because of its nice tuish nature

if you can stomach go, i’ve been meaning to give https://github.com/charmbracelet/bubbletea a try

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮

Armitag3 posted:

if you can stomach go,

let me stop you right there,

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
idk i've never even seen go code. is it any good?

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

curses is just linuxailures failing to copy turbovision

Zlodo
Nov 25, 2006

Sweevo posted:

curses is just linuxailures failing to copy the Minitel

Archduke Frantz Fanon
Sep 7, 2004

Silver Alicorn posted:

idk i've never even seen go code. is it any good?

quote:

designed at Google

:thunk:

Broken Machine
Oct 22, 2010

code:
a mild curse - may you step on a staple at some point in the future, and be momentarily uncomfortable.  but it's not enough to break the skin much. just slightly irksome for a bit

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
well I'm having an ok time programming with curses, it seems to do what I need. I'm wrapping functions to make them do what I want (i.e. a wrapper around getkey() to handle inputs like KEY_RESIZE in a useful way). i'll let you know if I find any cool tricks

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I just got mouse input working :hellyeah:

I've done all this before, it's kinda sad how much I forgot after 8? months

Hed
Mar 31, 2004

Fun Shoe
notcurses looks pretty cool

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

loving programming

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
ah, screen.getstr() returns a bytes object and not an actual string, so I have to decode it from utf8 or whatever to actually use it. strange choice

Grum
May 7, 2007
some of those that program curses
are the same that run posix

Internet Old One
Dec 6, 2021

Coke Adds Life

Sweevo posted:

curses is just linuxailures failing to copy turbovision

They ported turbovision to linux

https://github.com/magiblot/tvision

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
this isn’t so much curses as general python but I worked out how to make a tree :)

root of all eval
Dec 28, 2002

If you wanted a tree skip the python and just bury a seed, ya silly!

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
I tried growing an avocado once but it got some kind of rot and died

Best Bi Geek Squid
Mar 25, 2016
op make a yospos roguelike

green, natch

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
im making a game but not that.

Neslepaks
Sep 3, 2003

curses is pretty cursed

i like urwid for python tuis. it was abandoned for a few years but seems to be alive again now \o/

well-read undead
Dec 13, 2022

i curse a lot when i'm programming, does that help op?

shitface
Nov 23, 2006

10 PRINT “gently caress THIS poo poo”
20 GOTO 10

goblin week
Jan 26, 2019

Absolute clown.
i program curses for enemy technowizards

echinopsis
Apr 13, 2004

by Fluffdaddy

Grum posted:

some of those that program curses
are the same that run posix

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
thanks for the suggestions for alternatives but I don’t think I’m able to install them on the SDF public access Unix system. maybe I can ask though

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
oh btw I tried loading my game on Windows and it just quits back to the command prompt after like 5 seconds, without displaying anything. dunno what’s up with that. yes I have python and curses installed

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Silver Alicorn posted:

oh btw I tried loading my game on Windows and it just quits back to the command prompt after like 5 seconds, without displaying anything. dunno what’s up with that. yes I have python and curses installed

i can’t help you op. i also don’t know why

Adbot
ADBOT LOVES YOU

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮
thanks anyway

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply