Is there some sort of program or something to turn your text program graphical in C?

Thank You,


  • Depends on what you need. If you need just a simple popup, you can call zenity - it's a command-line application. So all you need is basically popen() that command and read it's output. – Sergiy Kolodyazhnyy Oct 10 '18 at 19:28
  • There are plenty of other toolkits that can be used. Why specifically do you not want gtk+, but do want C? – dobey Oct 10 '18 at 22:23
  • Because gtk is basically a language in and of itself. – Christopher M Oct 11 '18 at 17:25

Here's a simple way with calling external program - zenity. This way your command-line C code is now a GUI app by virtue of using zenity's simple input popup dialog, although this method isn't particularly secure.

#include <unistd.h>
#include <stdio.h>

int main(){
    FILE *zenity;
    char answer[getpagesize()];

    if ((zenity = popen("zenity --entry","r")) != NULL){

        printf("User's answer:%s\n",answer);
    // we get here if above check failed
    perror("zenity exited with non-zero exit code");

    return 0;
  • Thank you! Could you do more advanced graphics options in zenity, like gtk color and sound and window color text, position? – Christopher M Oct 10 '18 at 21:35
  • 1
    @ChristooherM Not really. zenity has set of popups prebuilt. You can customize some, like --form. But also look into yad , that tool is more flexible. But zenity comes preinstalled. If you need Gtk graphics and more or less easy code, consider switching to Python, maybe with Tk ( a built in GUI module ) – Sergiy Kolodyazhnyy Oct 10 '18 at 21:40
  • Thank you! I will look into this! – Christopher M Oct 10 '18 at 21:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.