Skip to content
Sign upLog in
← Back to Community

How do I create buttons in Python?

Profile icon
Aqual

Is there a way for me to create multiple buttons in Python on this website?

Voters
Profile icon
WannyHD
Profile icon
RiddikNeetipall
Profile icon
jingsaning
Profile icon
Aqual
Comments
hotnewtop
Profile icon
[deleted]

You could have some sort of a selection menu with the arrow keys, but buttons with the mouse will not work.

Profile icon
Aqual

@sugarfi
ok, how do I do that?

Profile icon
[deleted]

@Aqual
you can use the curses library (https://docs.python.org/3/howto/curses.html)
and also this article seems like a pretty good tutorial on the subject
https://codeburst.io/building-beautiful-command-line-interfaces-with-python-26c7e1bb54df

Profile icon
CodeLongAndPros

@sugarfi
Look at asciimatics; it's higher level than Python Curses (I know) and supports TUI.

Profile icon
[deleted]

@CodeLongAndPros
yeah, but curses is easier for a beginner.

Profile icon
CodeLongAndPros

@sugarfi

curses is easier for a beginner

asciimatics is literally Tk for terminal. They have documentation, and support mouse clicks.

Profile icon
Aqual

Can you walk me through this?

Profile icon
Aqual

Ok.

Profile icon
RohilPatel

Don't you need a server on frontend to make this work?

Profile icon
emilyUsesPascal

You cannot create buttons in the terminal, however you can have a webserver and have buttons there