So being new to the C language i want to program a simple window or GUI. are there any good web pages or books i could get to learn how to do this? I've searched around on the net and haven't come up with anything! or if someone could send me on the right track like what to #include and maybe some important commands that i will need that would be awesome! thanks!
Check out GTK. You didn't say what OS you are using. GTK is cross platform, but easiest to use on Linux.
You need a gui toolkit, you can either use one built into your OS (eg the Win32 API on windows) or pick a platform independant one
Qt http://qt.nokia.com/ is probably the most popular full featured one, or you can start with something quicker and easy like http://www.fltk.org/
Related
Recently I started to have a look at the GTK library in C, and wanted to create GUI application. In fact, I want to create an image application, but I don't know how to make my application looking exactly the same as my drawing, I've looked throught the gtk3-demo and also the widget factory but problems remains;
How to create GUI application, how do I know which container should I use, how do I know what kind of widget ? etc... So I have a picture of what I want to do, but I have absolutly no idea how. What is the process, what question should I ask myself in order to get my GUI application done ? Drawing of my application link
I would very much recommend you play with the Gtk3 GUI using python. You can interactively create windows, containers. Even later, it is much faster to develop the GUI in python, as many have already experienced.
Most of the Gtk3 C/C++ tutorials are available in Python too.
Glade is excellent in many cases - particularly if you want only standard behaviour of the widgets. If you even slightly wander from that straight path, things can get complicated quickly.
If it is really necessary, there are several ways to incorporate C/C++ functions into the Python GUI to make those critical apps go faster.
I'm learning C (I just finished Chapter 2 or Unit 2) of the C Programming Language, I skimmed to the end and saw that at no point anything was said about how to create a GUI, and from what I've looked up, it seems I have to use a framework, but I hate the idea of that. How would I create a GUI without a framework? How exactly do these frameworks work and what language are they written in? I'm not making a massive application, even if it takes me a week, would it be feasible to write a GUI application (in C) to do something simple like creating a window?
You can build your own framework based on OpenGL or Xlib. Or use good graphics library like Motif or CGUI. Or use something awful like GTK.
Not the best road to take. I would suggest a cross platform library, like GTK+.
Yeah, no go.
C can't do anything except manage memory and possibly do software interrupts (if you do pointer hacking).
You need a library to do anything.
GUI is very complex, you can't do anything "simple" with it. It's a problem I face every single day.
If you want a window in C, you need X11, GTK, Windows API, Video hacking, or other fun stuff.
Oh, and Video hacking is a no go, OS will throw an exception if you even try to touch video memory without its permission.
Oh, and the "simple button" you speak of, in Windows API is actually a Window itself, not very simple.
You can make a basic framework using the WINAPI
There is a great tutorial here.
The problem with using C and primitive frameworks like WINAPI is that manging layout and state becomes exceedingly difficult.
If you targeting a normal operating system, the C only requirement becomes unreasonable. I recommend you go with C++ and Qt and compile your C code in a C++ compiler.
Hello StackOverflow Community,
I am writing a MicroMouse Simulator in C language. And I wanted something to visualize the way the maze is being solved like this -- http://www.youtube.com/watch?v=N9TkDgJNJso
I've been researching a way to accomplish this, but I haven't found anything with enough documentation to accomplish my goal.
I don't want to implement this using ASCII symbols, to me it doesn't look professional.
Is there any good GUI interfaces that I could use in C to help me accomplish this? And if so, how would I use it? I don't mind having to code in another language like Java or Python to accomplish my goal.
I saw the video that you want to make. After watching the video I feel you don't need a GUI library for this simulator program.
Here is a list of libraries that you can use.
1.OpenGL This is a 3D graphics API which also can be used for 2D and can be used with both c/c++
2.SDL This library is easy to understand for a beginner. For your program this library is better and can be used with both c/c++.
3.winBGIm This is same as the graphics.h that you found and can be used both c/c++ but it is only for windows.
If you are looking for GUI library then here's a short list.
1.GTK This is written in c and is a popular GUI library for c. You can find a GUI editor for gtk forms called glade which enables quick & easy development of user interfaces.
2.WxWidgets This is written in c++ so you have to use c++ rather than c.
3.FLTK
There are many more libraries besides these which you can find in google. You said
I do not mind having to code in another language like Java or Python to accomplish my goal.
Then for java you can use swing and If you are windows developer then use the windows form application in visual c++; then development of your program will be very easy.
SDL is one of candidate for C in order to make GUI Simulation. Lazyfoo is one of the best site I found for beginner.
SDL is strongly portable. It's written in C and there're a lot of documentation and tutorials.
I've written a code in linux OS which produces prog.out as output file.
Now I've to write GUI for the code.
what are best ways to write it?
PS - I wanted to choose between Java Swings and openGL.
Which is best for writing a simple GUI and integrating it with my C- Application
Thanks in advance
OpenGL is a rendering library, not a UI toolkit. Comparing it to Swing doesn't make sense. And you can't choose Swing for a C application, unless you'd rather do the UI in Java and interact with a C "backend".
For a pure C solution, the best choice would probably be the GTK+ toolkit.
Try Anjuta...
http://projects.gnome.org/anjuta/
If you are prepared to use another language (you mention Java) then you may find C++ and Qt to be a good fit. Linking to the existing C code will be trivial and Qt works well on a great many platforms should you ever wish to support other platforms in addition to Linux.
hi every one i want ask that i have made a program and i have store a data in csv file. now i want a gui which includes buttons which upon pressing opens a a file and plot a graph.is there a way through which i can add gui in my program using gcc.and also i want to ask how can i make a moving graph just like ECG.
thank alot.
Have you looked into using a toolkit like GTK+, if not i would suggest you check it out. GTK+ is written natively in C so i think it should work for you.
Rephrasing your quesiton:
You have a C program that stores data in a csv file. You wish to display this information as a graph but don't know how to build a GUI or graphical display. Further, you want animation (it would be good if you linked to what "ECG" is) probably to display temporal aspects.
If I have this right, I suggest you learn the GTK and Cairo libraries and use those to build your GUI. Build GUI's is tedious and unrewarding work (to me), particularly in C. I'd think hard about if you really want to bother making a GUI instead of doing something simple like calling out to gnuplot to build the graph as a file that the user can open, though this won't get you any animation.
I suggest you switch your project to C++ and use Qt for your GUI.
If gcc is not a requirement, then check out SciPy or Octave.