ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Anybody know how to use the Python exec statement? I'm working on a GUI, and need to change the colors/states of a number of buttons when one is pushed. If I print cmd instead of exec, the lines come out right.
Traceback (most recent call last):
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1316, in __call__
return apply(self.func, args)
File "weather2.py", line 58, in wd_ne
File "<string>", line 1, in ?
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1109, in configure
TclError: unknown option "-color"
I'm looking for a better way then writing out...
...eight times, and five similar lines to change states on air_pressure buttons, and five similar lines to change states for pressure_change buttons, for each of the eight wind_directions. What is that...? Nearly 160 lines?
A better way may be to change your algorithm. Maybe keep a tract of current_red_button and pushed_button, and only change their colours around.
Or alter the button pushed event responce to something like reset_all_buttons(), make_button_red(this).
This is my first GUI program, so I knew it would be ugly. I finally found it in the Tkinter module doc.
Of course, I had already implemented a way like Proud had suggested... Each button push first calls a function that turns all the buttons black, then turns the one pushed red. Only need to write out the color='black' lines once.
I still might use the idea above though, so I can pass any button_name, attribute, and setting to a function. Such as ... button_config(ap_hi_button, state, NORMAL)