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.
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 want to start a Process Manager project in C and it's suppose to have a Graphical User Interface. It's my first GUI project and I have no idea about it. After some searches I found that I should use winapi32 libraries.
My question is:
Should I write my project like a Console-based one and then I add GUI to it or I should think about GUI at beginning of my project?
I would like to say that it's best to write the application as a command line application, then write a wrapper in GUI. This way you get the most flexible application with a total separation between the GUI and functionality.
But I won't say it! :-)
From my experience it's very difficult to totally seperate the GUI from the application, and thus you should built it with GUI in mind. Your code must open windows, report progress, react upon GUI events, so you must be well familiar with the GUI system you use.
But you must also maintain a separation between the GUI and the functionality as much as you can. For example, make your callbacks short, and direct the funcionality to non-GUI parts of the application. If you need to report progress during long calculation, pass a callback to the calculation algorithm instead of mixing GUI progress commands within the algorithm.
You also must bear in mind that most (if not all) GUI system can do GUI commands only within the main application thread, and build the program accodingly.
So in summary - yes, think about GUI at the beginning, it will be easier this way, but also keep a good separation between the GUI and the functionality,
Why changing the program during development? Just design it like it should be in the end.
You could design your program in a way that enables you to use both, text and graphical user interface. Offer an abstracted interface to the core functionality and use it from the text and the graphical interface.
If you want start top-down and not bottom-up you should choose whatever you prefer to start with a text or graphical interface that calls stub-versions of your interface.
Why write your project like a console-based one, since it's gonna end up with a GUI?
If there are any things you want to try it out first (like you don't know how to do a,b or c), sure you can implement that as a side project.
But as far as your main Project goes, that's what I'd do :
Carefully plan and design
What is it gonna do?
How are you gonna do it?
What should the User Interface contain in order to fully accomodate what you need
Coding
Test and Debug.
Repeat 2 & 3 until perfectly satisfied.
Hint :
A. I wouldn't suggest you to add your GUI to an existing console app, 'coz this will most likely lead to messy code and/or a messy UI.
;-)
B. Always study before trying to implement anything. You simply can't imagine how much your knowledge of what can be done
influences what you can do (and most likely what you'll end up doing).
If you want to make an user interface, you can use QTCreator or Visual Studio forms projects...
QT is an excellent way to make cross-platforms and cute interfaces... Visual Studio forms are usable only in windows platforms.
When you're working with any of these technologies you have to put "componentes" in a "window" a then code them...
I'm having a problem for a SDL project, I'd like to show text on the window and allow the user to input text. As much as I know, there is no simple way to achieve that. Do you hava any suggestion?
Note: I use C programming langage. I know there is a library called SDL_ttf which doesn't seems to make the job I want.
I have to be honest, as I was reading your question, SDL_ttf immediately sprang to mind. It's not too hard to use and there are plenty of docs available.
What it sounds like you are looking for, is a library that provides a simple console interface, where your main programming interaction is to write(...) and read(...) text and it handles display, scrolling and so on.
This project has a lot of code showing how to implement a simple 'console' in SDL, and it does use SDL_ttf to do so.
I'm not convinced you are going to avoid it, unless you grab someone's library that hides it away from you like this one but you are going to have less control over the display and interactivity this provides.
I must go with benosteen, SDL_ttf is a really good option. For my part, I used this tutorial to make it work in my project. It's really simple and straightforward.
EDIT:
I had some troubles with the Blending functionality of SDL_ttf, but I managed to make it work after QuasarDonkey found the problem in this question.
Have a look for a straight forward example on how to use it and create text surface.
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/
Hi i want to make a text editor using c. I don't want to make any GUI, the text editor is going to be a console application. I would like to ask if there are any libraries which implement some basic functionality for example, i want to execute a function when user presses ctr+s.
You're going to want to look into the curses library. There are versions of it for most Unix-like systems as well as for console programs in Windows (and probably programs running under PowerShell, but not sure).
This library has functions for reading key presses, moving around the screen, and drawing window-ish borders with either ASCII or terminal graphics characters in a platform/terminal independent way. Some versions even have the ability to work with mice.
There's lots more that curses can help you do, but you'll have trouble appreciating it until you read more in depth about it and see some examples in action (and actually realize that they are using curses).
The most popular version for free *nix systems is ncurses and the windows version is called pdcurses.
Use ncurses and take a look at the the source code for vim.
Curses and other such libraries are a good place to start.
http://en.wikipedia.org/wiki/Curses_%28programming_library%29
You can find a simple ncurses-based text editor on my webpage here:
http://www.melvilletheatre.com/articles/cstuff/1.html