I need to be able to render my own GUI to the screen, but I'm not really sure how to do this considering I'm in a CLI environment. I don't want to install Ubuntu-desktop or anything, I don't need an entire desktop, just the ability to render directly to the screen.

I've read a bit about X. I assume I need to make something that implements it. Are there references that explain this? I'm assuming a low level language (e.g. C) will be necessary, but obviously I'd feel more comfortable if it was a higher level language required (e.g. Python).

Please let me know, I can't seem to find anything on Google. I don't think I'm searching for the right thing, perhaps I just need refined search terms.

What I'm developing is an application that I want to install on a single board computer. The computer would only be used for the purpose of this application, so I don't want to waste resources loading ubuntu-desktop or gnome just so that I can render my application. I really just don't want the extra overhead. Let me know if that changes anything.

  • Adding this as a comment as I'm not too sure about this, but... I think you do need a full desktop environment as Gnome and other window managers draw on the screen through the x-server, and the gui apps are "encouraged" to draw on the screen through them. Unless you want to develop your own window manager - and this I doubt. – Wolfer Feb 27 '13 at 19:17
  • @Wolfer Window managers don't draw on the screen. The X server draws on the screen (mediated by display drivers in the kernel, usually implemented as kernel modules). – Eliah Kagan Feb 28 '13 at 23:03
  • If you want to do full-screen apps with no windows involved and use python over C, check out the SDL library. Python bindings exist here: pygametutorials.wikidot.com. SDL applications run on top of X, wayland, framebuffer, SVGALib and much more. – aquaherd Feb 28 '13 at 23:03
  • @aquaherd I recommend turning that into an answer. Even as it is, it's a perfectly good answer (and not a link-only answer). Of course, if you want to expand it further, you could do so. The fundamental point about the similarity between game engines and the application the OP wishes to develop is a good one that merits inclusion in an answer. – Eliah Kagan Feb 28 '13 at 23:08

If you want to do full-screen applications with no windows involved and use Python over C, you have several options:

Game engines: For example the SDL library. Python bindings exist here. SDL applications run on top of X, wayland, framebuffer, SVGALib and much more. It will give you full-screen graphics and for a SOC you will only need a frame-buffer-device, e.g. when you see the Linux mascot during boot, you are already there. However, if you have some advanced GUI like a modern car cockpit in mind, it might involve OpenGL for anti-aliasing. For an ATM (automatic teller machine) like GUI it will miss the standard buttons and boxes which you would have to implement yourself. Many SDL games in the ubuntu repositiories can be recompiled to run under a framebuffer.

Linux installers: The debian-installer uses the gtk+ toolkit on top of a framebuffer device, no X involved. You will have all Gtk+ widgets at your command, and good text rendering with pango, modern graphics with anti-aliasing with cairo. Python bindings exist. The OpenSuse distribution has a similar installer on top of QT.

Text mode graphics (TUI): If you have only text output with a few buttons to render, consider using the ncurses library. It will allow you a textual user interface with a high-level API. midnight-commander is a good example. Python bindings exist.

Commercial biddings: If this is a professional project, employing other commercial toolkits and realtime operating systems is an option. See also this and similar tagged questions, even without linux at Stack Overflow.

Helpful search keywords

  • microcontroller gui library
  • immediate mode graphics
  • DirectFB
  • RTOS graphics
  • RTOS gui toolkit
  • custom linux gui
|improve this answer|||||

Most users who don't install GUIs don't want to run GUI applications. There are many options for installing a GUI on a server and some of them are quite lightweight. You do not need a whole desktop environment to use the X window system. Installing X11 and a window manager, or possibly even a lightweight desktop environment, will probably do what you need.

If you've considered that (including the part about CLI users wanting to run CLI programs), you probably have a remarkable, unique set of circumstances for wanting to do this. If you expand your question to explain them, you might get more useful answers.

If you really do want to reinvent the lightbulb and reimplement your own GUI, aquaherd's comment (which I'm hoping will become an answer soon) explains the basics of how.

|improve this answer|||||
  • Check out my edit for more details on my purpose. Hopefully it will clear some things up. – Freesnöw Feb 28 '13 at 23:24
  • @Xan You say you don't want to waste resources loading ubuntu-desktop or gnome just so that I can render my application. But neither of these is necessary. Both are far heavier than X11 with a simple window manager like twm ...or even with no window manager at all (a pure X11 application can take care of window management for itself--one trivial and frequently appropriate way to do this is for it to use the whole screen all the time). – Eliah Kagan Feb 28 '13 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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