<p>Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source?
I know that debconf can be used with various frontends, I would like to build something similar but programmable.</p>

[{'answer_id': 40398, 'author': 'Joseph Bui', 'author_id': 3275, 'author_profile': 'https://Stackoverflow.com/users/3275', 'pm_score': 0, 'selected': False, 'text': '<p>Maybe tcl/tk would provide what you want <a href="http://www.tcl.tk/" rel="nofollow noreferrer">http://www.tcl.tk/</a></p>\n\n<p>Here\'s the page on interfacing with curses. There is a claim there of integration with ncurses.</p>\n\n<p><a href="http://www2.tcl.tk/2372" rel="nofollow noreferrer">http://www2.tcl.tk/2372</a></p>\n'}, {'answer_id': 40554, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>There\'s <a href="http://zemljanka.sourceforge.net/cursed/" rel="nofollow noreferrer">Cursed GTK</a>, but it seems a bit dated.  I found some references to a port of Qt to ncurses called Qt Console, but it seems to have disappeared.</p>\n'}, {'answer_id': 155542, 'author': 'Lorenzo Boccaccia', 'author_id': 2273540, 'author_profile': 'https://Stackoverflow.com/users/2273540', 'pm_score': 2, 'selected': False, 'text': '<p>you could write your program to uses ncurses, and then use <a href="http://pdcurses.sourceforge.net/" rel="nofollow noreferrer">PDCurses</a> to convert it to an X11 application - as the readme advertise.</p>\n\n<p>I know it because I\'ve used it as portable curses, though I\'ve never tested its X11 capabilities</p>\n'}, {'answer_id': 172329, 'author': 'Brendan', 'author_id': 199, 'author_profile': 'https://Stackoverflow.com/users/199', 'pm_score': 2, 'selected': False, 'text': '<p>Not exactly a library but you could consider writing a web app that degrades well to Lynx</p>\n'}, {'answer_id': 172336, 'author': 'olle', 'author_id': 22422, 'author_profile': 'https://Stackoverflow.com/users/22422', 'pm_score': 2, 'selected': False, 'text': '<p>The <a href="http://www.gobolinux.org" rel="nofollow noreferrer">GoboLinux</a> guys have created their own toolkit for python called <a href="http://www.gobolinux.org/abstk/" rel="nofollow noreferrer">AbsTK</a>, they use it for their installer, which actually works really good. I have never used the toolkit myself, but the apps built with it seems solid.</p>\n'}, {'answer_id': 172348, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I think what\'s used for configuring the linux kernel when compiling is dialog/cdialog/xdialog. But it\'s been a while since I\'ve compiled a kernel, so my memory may be off. The most promising link I can find is this one for <a href="http://xdialog.free.fr/" rel="nofollow noreferrer">Xdialog</a>.</p>\n'}, {'answer_id': 173890, 'author': 'noid', 'author_id': 13340, 'author_profile': 'https://Stackoverflow.com/users/13340', 'pm_score': 1, 'selected': False, 'text': '<p>By using a library that targets both the text-mode and GUI environments, you have a big risk of getting stuck with the worst of both worlds.</p>\n\n<p>You will be better off structuring your code using the <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="nofollow noreferrer">MVC pattern</a>, and providing separate views and controllers for each platform you target. Pushing all the logic down to the model classes has several other benefits:</p>\n\n<ul>\n<li>The code will be easier to test because you are forced to keep the user interface out of the actual domain logic.</li>\n<li>Your program can have user interfaces that have very little in common, e.g. a web UI, or an UI driven by speech.</li>\n<li>You can run the program easily with no UI at all (i.e. script it) by accessing the model classes directly in the same way that the controller classes do.</li>\n</ul>\n'}, {'answer_id': 2730371, 'author': 'duncan', 'author_id': 203718, 'author_profile': 'https://Stackoverflow.com/users/203718', 'pm_score': 2, 'selected': False, 'text': '<p>The library that powers YaST independence to do ncurses, gtk and qt with one codebase provides what you are looking for, and it is not tied to YaST itself.</p>\n\n<p>Actually libyui only requires the standard C++ library and phtreads (IIRC). The UI plugins require of course the respective libraries (Qt, ncurses). YaST uses libyui via a set of YCP bindings that export a YCP like API on top of libyui.</p>\n\n<p>The library is a bit lowlevel (one layer below an event loop), my colleage Klaus Kämpf wrote about using it some time ago in <a href="http://kkaempf.blogspot.com/2008/05/declaring-ui-independence-earlier-this.html" rel="nofollow noreferrer">his blog</a>, including binding to scripting languages it using swig.</p>\n\n<p>The only part that is SUSE specific is the packaging, so you would need to package it yourself. Stackoverflow did not allow me to link more than once. The code of the library is linked from Klaus blog. Replace libyui for "qt" and "ncurses" for the plugin\'s code.</p>\n\n<p>Also google for "YaST Independence From YCP" to find a blog entry from Andreas Jäger on the subject.</p>\n'}]
['https://Stackoverflow.com/questions/40259', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4118/']