TUI (text user interface) for D?
My terminal.d could be used as a foundation for a TUI library.
https://github.com/adamdruppe/arsd/blob/master/terminal.d
It has no required dependencies, so you can simply download that one file and start building with dmd yourfile.d terminal.d
. Here's an example program getting input: http://arsdnet.net/dcode/book/chapter_12/07/input.d
You can also use terminal.moveTo(x, y); terminal.color(Color.green, Color.black); terminal.writef("something"); terminal.flush();
and such to move and draw.
Look for version(Demo)
in terminal.d itself for a main
which handles all kinds of input events, including mouse events.
While terminal.d mostly offers lower-level functions (its main high level function is terminal.getline
, great for line based apps but not TUIs), it should give all the foundation needed to write a little text widget library.
and I think someone might have done that once but I don't recall where.
terminal.d works on Windows and Posix systems, for the most common terminals like xterm. ncurses is more comprehensive and probably has fewer bugs on more obscure targets but terminal.d, being a single file, is easier to build.
Python Terminal/Text UI (TUI) library
Try using the curses module.
Here's an introduction.
C TUI Developement - Help / Tutorials?
Well, to be honest, you can. But as others will tell you, curses is the right tool for the job.
That said, this isn't the 80s anymore. <overgeneralization>Everybody uses Xterm.</overgeneralization> Xterm uses ANSI VT100 control codes, mimicking the classic DEC VT-100. If you target this, you should be reasonably ok and portable.
But curses is really nice. It does a lot of the hard work for you (and there's plenty of hard work left to keep you busy).
Input in a Python text-based GUI (TUI)
Also try useful built atop curses
high level framework urwid
. With that thing you could do rich and colorful interfaces. Buttons, edit fields, even status bars and progress bars and all that you need. To start working you only need Python curses
installed and urwid
folder with its sources (you can transfer whole urwid
library with your application as standalone bundle!). It works even under cygwin
under Windows XP/7 where is, as we know, no curses
ports for Python
.
urwid
portfolio
No more lowlevel, sometimes very boring curses
:)
Python TUI libs
You might want to check out Unicurses, which wraps the python core curses module in UNIX systems and wraps the free pdcurses library on windows-based machines.
This library is designed to emulate the syntax and style of the original ncurses library, so if you're interested in learning TUI design using curses-style programming, then check it out.
Urwid is, from what little documentation I've read, a very interesting library which uses event loops (the reactor pattern) as a basis for application design, much like tkinter or Twisted. Also, urwid has an event loop class specifically designed for use with Twisted, so if your aim is to created TUIs for use over networks, its a good choice. Twisted also uses the reactor pattern, so if you want to learn that style, I'd recommend it.
Finally, if you do go with an ncurses-style library, check out Dan Gookin's book on ncurses. A very good resource, and the only one I know of which is in print today.
There are other options such as newt, pygcurses, and so on, but this should get you started. Best of luck, TUI programming today is one of those technological fetishes that can be hard to break into, but it's rewarding.
convert TUI to GUI in haskell
This will get you started.
targetFile <- fileChooserGetFilename fch
At this point, targetFile
has type Maybe String
; that is, it will return either Just "somestring"
or Nothing
. You want the "somestring"
part, if it's available. You can get it by pattern matching:
Just targetFile <- fileChooserGetFilename fch
This will fail with an opaque error message if the result of fileChooserGetFilename
returned Nothing
. For more robustness you can case analyse the result:
maybeTargetFile <- fileChooserGetFilename fch
targetFile <- case maybeTargetFile of
Nothing -> fail "I need a filename!"
Just file -> return file
The other problem is in this line:
found <- matchWord fileData targetWord
x <- m
is used to bind the result of an action m
into the variable x
, but matchWord
returns an Int
, not an action (eg. IO a
for some a
).
Text Base User Interface Library for (C or C++) Windows?
Cygwin has a fully functional ncurses, I think.
Of course, if you build with Cygwin, it needs Cygwin to run, but that's the deal.
Whenever I've dealt with TUI apps, pdCurses has always been enough, but we didn't need that much.
Related Topics
How to Diff Top Lines of Two Files Without Intermediate File
How to Split a Ca Certificate Bundle into Separate Files
Using Find with -Exec {}, How to Count the Total
How to Repeat a Dash (Hyphen) in Shell
How to Limit the Cache Used by Copying So There Is Still Memory Available for Other Caches
How to Release Hugepages from the Crashed Application
What Does "$" Give Us Exactly in a Shell Script
Set Static Ip If Not Obtained from Dhcp (Script)
Where Do You Download Linux Source Code
Run Jenkins Jobs on Linux Under a User
Pass Private Key Password to Openvpn Command Directly in Ubuntu 10.10
Check If File Is Open with Lsof
Systemd: "Environment" Directive to Set Path
How Does Stat Command Calculate the Blocks of a File
How to Implement a Practical Fiber Scheduler
Installing Qt on Linux, Cannot Find -Lgl
Get a Nanosecond-Precise Atime, Mtime, Ctime Fields for File (Stat)