Python GUI questions

Rick Johnson rantingrickjohnson at gmail.com
Wed Mar 20 13:37:26 EDT 2013


On Tuesday, March 19, 2013 10:21:06 PM UTC-5, Terry Reedy wrote:
> On 3/19/2013 10:16 PM, Ranting Rick wrote:
> > [snip code]
> 
> when I run this, and click the button, I get:
>
>    TypeError: cbButton() missing 1 required positional argument: 'self'
> 
> ...when I remove 'self' from cbButton, I get the expected
> I should do something here!

Oops :-), good catch Terry! I had copy-pasted the OP's original method however i forgot to remove the "self" parameter; then i had to convert my Python2.x code into 3.x code, which was not terribly difficult, however, this "pit stop" was distracting enough that I forgot to click the button while testing. 

> When I enter something in the Entry box and hit return,
> nothing happens.  

My example does not bind the "KeyPress-ReturnKey" to any callback, so what were you expecting to happen when you pressed enter?

> I presume that is because the example is not complete.

Well it's as complete as it needs to be :-). Any more complete and it would less of a teaching exercise and more of a "copy-paste" exercise. I did not want to just gift wrap an answer for the OP. My hope is that he has the basic skills to turn that incomplete example into useable code. If not, well, then he needs to study that tutorial link i sent early in the thread. 




More information about the Python-list mailing list