Alternatives to standard c input/output

  • Thread starter Thread starter dE_logics
  • Start date Start date
  • Tags Tags
    Standard
Click For Summary
SUMMARY

This discussion focuses on alternatives to standard C input/output, specifically the use of GUI libraries such as Qt and GTK for Linux applications. Participants emphasize the complexity of using these libraries compared to standard I/O, highlighting the need for understanding event handlers and callbacks. The conversation also touches on the comparative simplicity of implementing GUIs in Python with wxPython, illustrating the increased workload required for similar tasks in C/C++. The consensus is that while GUI development is more intricate, mastering the fundamentals of programming is essential before diving into graphical toolkits.

PREREQUISITES
  • Familiarity with C/C++ programming languages
  • Understanding of event-driven programming concepts
  • Knowledge of GUI libraries such as Qt and GTK
  • Basic Python programming skills for comparison with wxPython
NEXT STEPS
  • Research the Qt and GTK development packages for Linux
  • Learn about event handling and callbacks in GUI programming
  • Explore wxPython documentation and tutorials for Python GUI development
  • Study best practices for transitioning from console applications to GUI applications
USEFUL FOR

Software developers, particularly those transitioning from console-based applications to GUI development, as well as educators teaching programming fundamentals and GUI design principles.

dE_logics
Messages
742
Reaction score
0
I assume we should have commandline and GUI based...like QT and GTK (in linux) right?

So if we want to use these i/o interface, we need to include these QT and GTK libraries (which will be most probably included in the QT/GTK-dev package) instead of stdio.h right?

Or, is it that the alternative is completely different and I'm completely wrong above?

If I'm right, can anyone give me a link to a tutorial teaching how to use QT/GTK/(other interfaces) libraries?...or what package are they contained in?
 
Technology news on Phys.org
It's far, far more complicated than that. For one thing, you don't need to worry about event handlers and callbacks when you're working with stdio; if you're using Qt/GTk/etc, you do. You also need to learn about the API to your graphical toolkit, which takes time, effort, and tears.

As an example of this sort of thing, the easiest thing to do is not to consider C/C++ at all but instead to look at Python. Implementing a GUI to a program is much easier in Python than in C/C++, but there's still quite a bit of work involved. For instance, you'd implement the standard Hello, World! app in Python using something like the following.

Code:
#!/usr/bin/env python

print "Hello, World!"


This is much simpler than the corresponding C/C++ version, but it does pretty much the same thing: it prints "Hello, World!" to standard output. Now consider trying to do the same thing with the wxPython toolkit.

Code:
#!/usr/bin/env python

from wx import *

app = wx.PyApp()
frame = wx.Frame(None, wx.ID_ANY, "Hello, World!")
frame.Show(True)
app.MainLoop()

You do much more work here. You have to

  • Import the wxPython module.
  • Create an instance of wx.PyApp in which to hold your graphical application.
  • Create a wx.Frame object for the actual graphical output, and specify its parent widget, its identifier, and its window title.
  • Actually tell the widget to display itself.
  • Hand off control to the wx.PyApp.MainLoop method so as to handle user-generated events.

And that's just to print Hello, World in the title bar. To have it in a text box in the app involves even more work.

The moral of all this is to concentrate on learning the fundamentals of whatever language you're using for as long as possible; you'll have plenty of time to look at graphical toolkits later on.
 
At least we don't have paradoxes and REALLY unanswerable question like in physics...


Then what about compiz?...I think that will be tooooo heavy. :smile:
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 26 ·
Replies
26
Views
6K
  • · Replies 87 ·
3
Replies
87
Views
9K
  • · Replies 23 ·
Replies
23
Views
8K
  • · Replies 26 ·
Replies
26
Views
6K
  • · Replies 12 ·
Replies
12
Views
4K