ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please explain with a little detail
I don't see what is messy about clicking a button resulting in message to be send over a socket or reading data from a socket, parsing it and placing it in some widgets.
It's clear and easy when you think about it... It changes when it comes to implementation. Look at this code: http://www.dci.clrc.ac.uk/Publicatio...kbook/msg.html The code doesn't look very readable, you have positions given in pixels (it doesn't scale well) and so on. Code in GTK or Qt would look much better and will be written faster (when using manual, not when you're proficient in the language, because that's a completely different story), even when you decide not to use a graphical tool to draw the dialog.
The thing with Tcl wasn't designed to be used for writing GUI. You can still see it...
Personally, I don't think anybody will have a problem reading that code.
With regards to the 'hardcoded' positions, I might misunderstand your 'does not scale well' but the window where the widgets are placed in has a fixed size so it's not a real problem.
I don't use place (pack works for me), so not sure about the exact implications on resizing windows.
With regards to the 'hardcoded' positions, I might misunderstand your 'does not scale well' but the window where the widgets are placed in has a fixed size so it's not a real problem.
So I'll try to clarify. Scaling when resizing is one thing, but I'm more concerned about a case when you change font used to display the text, for example. When size is changes and all elements use fixed positions, there's huge chance for all the things to make a big mess (eg. long text that doesn't fit the place for it). It's a very big problem also for translations.
What you say is that if you place a text entry widget of let's say 100 pix wide on a screen and it fits 10 characters of a certain font, change in font will make that it does not fit any longer.
I was under the impression that that is always the case. The tiny bit of GUI programming that I have done under windows also 'suffers' from it (or I've never found a way to prevent it).
So this is not the case when one uses GTK or Qt? Sounds to good to be true. I see problems coming in that case as well, but that will make a long discussion.
gtk+ has a good tutorial on making a simple hellow world and
2 button program using C its on there site. Hope that helps
i went though it and im a very novice C programmer. Make sure
to have some understanding of OOP tho.
What you say is that if you place a text entry widget of let's say 100 pix wide on a screen and it fits 10 characters of a certain font, change in font will make that it does not fit any longer.
I was under the impression that that is always the case. The tiny bit of GUI programming that I have done under windows also 'suffers' from it (or I've never found a way to prevent it).
So this is not the case when one uses GTK or Qt? Sounds to good to be true. I see problems coming in that case as well, but that will make a long discussion.
It is true... Of course you can force a window or label or whatever to be 100px wide, but it's very rare to do it this way. A good topic for a new long discussion...
It's clear and easy when you think about it... It changes when it comes to implementation. Look at this code: http://www.dci.clrc.ac.uk/Publicatio...kbook/msg.html The code doesn't look very readable, you have positions given in pixels (it doesn't scale well) and so on. Code in GTK or Qt would look much better and will be written faster (when using manual, not when you're proficient in the language, because that's a completely different story), even when you decide not to use a graphical tool to draw the dialog.
The thing with Tcl wasn't designed to be used for writing GUI. You can still see it...
1. I can read it. Looks simple to me. It's readable to a programmer - if
you spend a little time studying it.
2. GTK code isn't "readable" either.
How would C++ code look I wonder?
3. pack [ button .b -text hello -command exit ]
Is this difficult to read too? Try the equivalent C++ code.
4. Er, well what is TK designed for exactly? (And C++)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.