Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 April 26, 2001 19:19:06

Ed W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


Hello, folks,

First to set the scene, I'm an old guy, in the computer field since
1965. I have to build a small simulator to simulate a big device that
doesn't exist yet, but its interface is well defined. It will simulate
that device by communicating via a MIL-STD-1397 type A parallel
interface card, residing in a PC. Some parts of the simulation will be
done in threads which handle the communications, but some will be done
with some kind of GUI. I've been doing GIU programming for about 8
years, at one level or another, but almost all with Windows and most
with MFC. I got permission from the boss to do this project with Linux,
which I have been looking at and reading about for 6 or so years, but
except as a toy, never actually did anything with it. I bought Eric
Harlow's GTK programming book last night, and see a lot of parallels to
the MFC stuff I did in years past. I won't have any problems there, I
don't think. But I have come up with a few questions that maybe you
folks can help me with:

I know that there are other GIU development tools out there, like Qt.
Is GTK+ the best place for me to be starting? I know, I'm asking to
start a flame war, and this is not my desire. I really don't know, and
want to know.

I see that GTK+ has some kind of resource files. Is there any kind of
graphical screen design tool, similar to the Microsoft Resource Editor,
where I can drag and drop controls; use a property box to define their
properties; stretch, mangle and bend them till I get the look I want;
and have all this saved in a file somewhere, automatically part of my
program? I know, I'm spoiled, but I'm used to that.

I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm sure
it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or 2.0, or
both? Is there a reason why I would want one over the other? Also, I
have probably every RH distro from recent years available. I wanted the
2.4 kernel, because I understand its implementation of pthreads is
better, but am I choosing unwisely here?

How resource intensive is GTK+? I have freely available a Pentium 166
PC which is compatible with the 1397 card. Will that be powerful
enough, and how much memory will it need? It has 16 MB now, which I
know is too little for X, but I could probably get it up to 80 MB pretty
painlessly. Would that do?

Thanks in advance,
Ed


_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 April 26, 2001 23:21:54

Paul D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


>I know that there are other GIU development tools out there, like Qt.
>Is GTK+ the best place for me to be starting? I know, I'm asking to
>start a flame war, and this is not my desire. I really don't know, and
>want to know.

Its mostly a stylistic thing. AFAIK, Qt is a C++ toolkit. GTK+ is a C
toolkit for which there are C++ (and many other) bindings. You should
probably take a look at some GTK+ programs and see what you think. GTK+
uses a layout model inspired by TeX, so its rather different than some
other toolkits which go for a more positional approach to layout.

I happen to dislike GTK+ quite a lot and love Gtk-- (the C++ bindings)
very much. There's no difference in the functionality, just the
programming style engendered by the bindings over the toolkit itself.

>I see that GTK+ has some kind of resource files. Is there any kind of
>graphical screen design tool, similar to the Microsoft Resource Editor,
>where I can drag and drop controls; use a property box to define their
>properties; stretch, mangle and bend them till I get the look I want;
>and have all this saved in a file somewhere, automatically part of my
>program? I know, I'm spoiled, but I'm used to that.

its called Glade. see www.gtk.org for a link, i would imagine.

>I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm sure
>it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or 2.0, or
>both? Is there a reason why I would want one over the other? Also, I
>have probably every RH distro from recent years available. I wanted the
>2.4 kernel, because I understand its implementation of pthreads is
>better, but am I choosing unwisely here?

The 2.4 kernel is better in every way, but has nothing really to do
with pthreads. pthreads are user-space threads; in the linux
implementation (or rather, the most common linux implementation), they
happen to use a rather gorgeous linux system call called clone(2). but
the kernel's handling of threads has not changed dramatically in quite
some time now.

>How resource intensive is GTK+? I have freely available a Pentium 166
>PC which is compatible with the 1397 card. Will that be powerful
>enough, and how much memory will it need? It has 16 MB now, which I
>know is too little for X, but I could probably get it up to 80 MB pretty
>painlessly. Would that do?

Basically, that will work just fine. GTK+ adds a small chunk of memory
on top of the amount caused by X. Ultimately, its the resources that
your program creates that are more likely to dominate things. Running
the GIMP in 80MB and expecting to work on large images, for example,
is probably going to be a bit disappointing. GTK+ really adds very
little in the way of CPU cycles over X. There is an extra layer of
code for GTK+ event/signal system, but the cost is low compared to the
drawing and computation done by a typical GTK+ program.

--p


_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#3 April 27, 2001 05:30:13

H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


On Thu, Apr 26, 2001 at 06:37:18PM -0400, Paul Davis wrote:
> >I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm sure
> >it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or 2.0, or
> >both? Is there a reason why I would want one over the other? Also, I
> >have probably every RH distro from recent years available. I wanted the
> >2.4 kernel, because I understand its implementation of pthreads is
> >better, but am I choosing unwisely here?
>
> The 2.4 kernel is better in every way, but has nothing really to do
> with pthreads. pthreads are user-space threads; in the linux
> implementation (or rather, the most common linux implementation), they
> happen to use a rather gorgeous linux system call called clone(2). but
> the kernel's handling of threads has not changed dramatically in quite
> some time now.
>

Ooh I think I know this one. The change he's referring to is probably the new "wake
one" behaviour, when 20 threads are select()ing on the same file descriptor, only one
gets woken up. This feature is basically for web servers and other internet services.
I imagine it wouldn't make much difference for his project.

_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#4 April 27, 2001 07:30:55

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


Ed,

I'm new to gtk as well, but will give you my perspective nonetheless (as I'm
sure several other people will).

Ed> I know that there are other GIU development tools out there, like
Ed> Qt. Is GTK+ the best place for me to be starting? I know, I'm
Ed> asking to start a flame war, and this is not my desire. I really
Ed> don't know, and want to know.

Gtk certainly seems to have a lot of momentum at the moment.

Ed> I see that GTK+ has some kind of resource files. Is there any kind
Ed> of graphical screen design tool, similar to the Microsoft Resource
Ed> Editor, where I can drag and drop controls; use a property box to
Ed> define their properties; stretch, mangle and bend them till I get
Ed> the look I want; and have all this saved in a file somewhere,
Ed> automatically part of my program? I know, I'm spoiled, but I'm used
Ed> to that.

I think you will want to look at glade.

Ed> I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm
Ed> sure it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or
Ed> 2.0, or both? Is there a reason why I would want one over the
Ed> other? Also, I have probably every RH distro from recent years
Ed> available. I wanted the 2.4 kernel, because I understand its
Ed> implementation of pthreads is better, but am I choosing unwisely
Ed> here?

Even-numbered minor versions (2.0, 2.2, 2.4, ...) are stable versions. Odd
one are development versions, so I think you should be okay with 2.4, though
I haven't tried it. There are api differences between Gtk 1.2 and Gtk 1.3.
I think all Linux distributions that ship Gtk will ship with 1.2.something.
If you're planning new development work you will want to at least keep your
eye on 1.3 series. Almost all the documentation you will find today is for
the 1.2 series.

Ed> How resource intensive is GTK+? I have freely available a Pentium
Ed> 166 PC which is compatible with the 1397 card. Will that be
Ed> powerful enough, and how much memory will it need? It has 16 MB
Ed> now, which I know is too little for X, but I could probably get it
Ed> up to 80 MB pretty painlessly. Would that do?

It might, though you are going to have to wait awhile for compiles. I do
development on a 450-MHz (mobile) PIII laptop with 128MB of memory. It's
sufficient as long as it doesn't page, which in this day and age happens
quite a bit. Many people have 256MB or more on development machines.

I recommend you also take a look at the various interpreted languages that
support Gtk interfaces. I use Python, but Perl and Ruby both have Gtk
interfaces as well. I suspect any of them will drastically reduce the
number of lines of code you need to write to generate an interface (I know
using Python will). I'm not sure what languages glade interfaces to besides
C, but I'm pretty sure there's Python support available.

--
Skip Montanaro ()
(847)971-7098

_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#5 April 27, 2001 17:18:33

Loban A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


> Ed> I see that GTK+ has some kind of resource files. Is there any kind
> Ed> of graphical screen design tool, similar to the Microsoft Resource
> Ed> Editor, where I can drag and drop controls; use a property box to
> Ed> define their properties; stretch, mangle and bend them till I get
> Ed> the look I want; and have all this saved in a file somewhere,
> Ed> automatically part of my program? I know, I'm spoiled, but I'm used
> Ed> to that.
>
> I think you will want to look at glade.

Yes, if it's a graphical gui editor you want, Glade fits the bill. Also look
into LibGlade. Glade saves the gui you created as an XML file. It can then
either generate C/C++/Other code for you, or you can use LibGlade to read
the XML file and have it auto-create it for you on the fly. LibGlade is great
because it allows you to make changes in the gui interface without having
to recompile, and it also makes it easier to write better MVC code keeping
the gui and generic code seperate.

Loban.

/-------------------------------------------------------------------\
| Loban Amaan Rahman <-- anagram of --> Aha! An Abnormal Man! |
| , ,http://i.am/loban|
\-------------------------------------------------------------------/

_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#6 April 27, 2001 20:40:16

Erik M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


On Thu, Apr 26, 2001 at 06:37:18PM -0400, Paul Davis wrote:
> >I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm sure
> >it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or 2.0, or
> >both? Is there a reason why I would want one over the other? Also, I
> >have probably every RH distro from recent years available. I wanted the
> >2.4 kernel, because I understand its implementation of pthreads is
> >better, but am I choosing unwisely here?
>
> The 2.4 kernel is better in every way, but has nothing really to do
> with pthreads. pthreads are user-space threads; in the linux
> implementation (or rather, the most common linux implementation), they
> happen to use a rather gorgeous linux system call called clone(2). but
> the kernel's handling of threads has not changed dramatically in quite
> some time now.

No, pthreads are not userspace threads in Linux. Linux doesn't use
userspace threads because its context switches are fast enough to do it
in kernel.

There is actually no difference between processes and threads in Linux,
it's just a matter of what the two process entities want to share: the
clone() system call handles it all. You can call clone() directly, but
there are also two well known convenience functions build on top of it:
fork() and pthread_create(). Actually, in Linux the whole pthread
library is just a large wrapper around clone() and friends.


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email:
WWW:http://www-ict.its.tudelft.nl/~erik/_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#7 April 27, 2001 21:00:13

Paul D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


>No, pthreads are not userspace threads in Linux. Linux doesn't use
>userspace threads because its context switches are fast enough to do it
>in kernel.

they don't use user-space context switching, its true.

however, they are managed by user-space code (hence the silent, hidden
"manager thread" started by pthreads.

in truth, the use of the clone(2) call makes linuxthreads a little bit
of a hybrid system. but they are closer to user-space threads IMHO.

--p

_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#8 April 27, 2001 23:05:17

Havoc P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


Ed Winchester <> writes:
> I know that there are other GIU development tools out there, like Qt.
> Is GTK+ the best place for me to be starting? I know, I'm asking to
> start a flame war, and this is not my desire. I really don't know, and
> want to know.

GTK is what we would recommend on this list. ;-) Both are certainly
reasonable. Qt requires a license fee if your software is
proprietary. GTK uses C and Qt C++.

> I see that GTK+ has some kind of resource files. Is there any kind of
> graphical screen design tool, similar to the Microsoft Resource Editor,
> where I can drag and drop controls; use a property box to define their
> properties; stretch, mangle and bend them till I get the look I want;
> and have all this saved in a file somewhere, automatically part of my
> program? I know, I'm spoiled, but I'm used to that.

What you want to do here is use Glade with libglade. libglade is a
library that gives you a GtkWidget from a resource file. Glade is the
actual GUI builder.

For an IDE type of thing, Anjuta is pretty nice, it's not quite
finished but you might like it and it seems usable. See
anjuta.sourceforge.net.

> I plan to install the latest 2.4 kernel, Red Hat 7.1 distro. I'm sure
> it will include GTK+, glibc, etc. Will that be GTK+ 1.2 or 2.0, or
> both?

7.1 includes only 1.2, which is the current stable version. 2.0 is a
lot nicer, but not yet released as stable. So you'll want to use 1.2
but be thinking about moving to 2.0 eventually.

> Is there a reason why I would want one over the other?

2.0 solves a lot of the frustrations and annoying aspects of 1.2, and
has more features, but ain't finished (yet).

> Also, I have probably every RH distro from recent years available.
> I wanted the 2.4 kernel, because I understand its implementation of
> pthreads is better, but am I choosing unwisely here?

Either 2.2 or 2.4 should really work fine for this. Be a bit careful
with threads; it's worth reading some of the archive posts on them
that have been on this list or gtk-app-devel-list. Things aren't
totally threadsafe as on Windows, instead you normally want all GUI
stuff in a single thread and only spawn threads to do non-GUI work
that blocks.

> How resource intensive is GTK+? I have freely available a Pentium 166
> PC which is compatible with the 1397 card. Will that be powerful
> enough, and how much memory will it need? It has 16 MB now, which I
> know is too little for X, but I could probably get it up to 80 MB pretty
> painlessly. Would that do?

80 mb with a P166 should be fine for a GTK app. It will be a bit slow
for an entire desktop with mail, web browser, apps running most
likely. If the P166 seems too slow with the Red Hat default setup, you
might try using a plain window manager such as fvwm or WindowMaker
instead of the full GNOME desktop.

As a random suggestion, I think "Teach Yourself GTK Programming in 21
Days" is probably a newer/more comprehensive book than Eric's older
book.

Several people have suggesting using a language binding such as PyGTK
or Gtk--; that adds a bit of complexity to getting started, e.g. PyGTK
has bad docs and Gtk-- doesn't come with Red Hat 7.1 (it's only on
powertools). But if you're a lot more comfortable in those languages
than plain C it might be worth it.

Havoc



_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#9 April 27, 2001 23:10:49

Wolfgang S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


>>>>> "Havoc" == Havoc Pennington <> writes:

> GTK is what we would recommend on this list. ;-) Both are certainly
> reasonable. Qt requires a license fee if your software is
> proprietary. GTK uses C and Qt C++.

This is no longer true. Qt is distributed under both the QPL and the
GPL.

W.

_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#10 April 27, 2001 23:55:11

Timothy M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Newbie questions


Havoc Pennington wrote:

> Ed Winchester <> writes:
>
>> I know that there are other GIU development tools out there, like Qt.
>> Is GTK+ the best place for me to be starting? I know, I'm asking to
>> start a flame war, and this is not my desire. I really don't know, and
>> want to know.
>
>> I see that GTK+ has some kind of resource files. Is there any kind of
>> graphical screen design tool, similar to the Microsoft Resource Editor,
>> where I can drag and drop controls; use a property box to define their
>> properties; stretch, mangle and bend them till I get the look I want;
>> and have all this saved in a file somewhere, automatically part of my
>> program? I know, I'm spoiled, but I'm used to that.
>

There are many more options in the GTK+ world than you may have been
accustomed to on other platforms; another is SDPGTK, a stable,
cross-platform (Posix & Win32) C++ binding for GTK+ that combines XML
layout files ("resources"), a much-more-object-oriented approach than
libglade, and advanced features such as built-in OpenGL support and
methods for simulating user interaction for tutorials & demos. You can
check out the library along with a complex ( ~ 100 dialogs ) application
athttp://www.k-3d.comRegards,
Timothy M. Shead


_______________________________________________
gtk-list mailing list
http://mail.gnome.org/mailman/listinfo/gtk-list

Offline

Board footer

Moderator control

Enjoy the 20th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support