Discuss Python-tk question in the Python Programming forum on Dev Shed. Python-tk question Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
I'm getting an error that color_change() takes exactly one argument in my terminal when I try to run the script. I'm not sure what is causing the error.
Also, what does "self" do? I can't find an explaination of using "self", I have searched several sites and pieced together some things I found to get this, but I'm not sure how "self" effects the script.
Posts: 404
Time spent in forums: 1 Week 5 h 17 m 59 sec
Reputation Power: 65
Quote:
Originally Posted by secmlt
I'm getting an error that color_change() takes exactly one argument in my terminal when I try to run the script. I'm not sure what is causing the error.
Well of course the functions expects an argument if you write it to expect an argument:
The program calls a perl script when the button is clicked that generates a random number (either 0 or 1) and the button that was clicked changes colors based on the result of the perl script. However, when I mouse over the button, the button always changes to gray. Is there anyway to make the button stay either green or red instead of turning gray when the mouse pointer is over the button?
Your code will use less resources if you have python generate the random number.
random.choice((0,1))
The "activebackground" combined with "background" gave me what I needed. Thanks for the help! Also, do you know of a website that explains the functions of python-tk?
I cannot use python to generate a random number unfortunately, because this is a project for work and my co-workers are obsessed with perl scripts... I'm the only one that uses python. My GUI has to be able to interface with perl scripts that spit out random numbers (it actually won't be random numbers but ping results that make the buttons change color).