By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

takes no arguments (1 given)

P: n/a
In the following Display inherits from the Tkinter class Canvas:

import sys
from Tkinter import *
class Display(Canvas) :
....
def fill_canvas() :
slop=self.slop
set_sr(int(self.cget('width'))+slop,
int(self.cget('height'))+slop)
self.refresh()
....

disp=Display(fred, None)
disp.pack()
def stupid(unused) : disp.fill_canvas()
disp.bind("<Configure>", stupid)
mainloop()

From the above I get:
Exception in Tkinter callback
....
File Ca_canvas.py, line 173, in stupid
def stupid(unused) : disp.fill_canvas()
TypeError: fill_canvas() takes no arguments (1 given)
What is going on?
I tried to do something similar with lambda
and got the same result.
Dec 3 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

On Dec 3, 2007, at 2:10 PM, Mike wrote:
In the following Display inherits from the Tkinter class Canvas:

import sys
from Tkinter import *
class Display(Canvas) :
...
def fill_canvas() :
def fill_canvas(self):
slop=self.slop
set_sr(int(self.cget('width'))+slop,
int(self.cget('height'))+slop)
self.refresh()
...

disp=Display(fred, None)
disp.pack()
def stupid(unused) : disp.fill_canvas()
disp.bind("<Configure>", stupid)
mainloop()
>From the above I get:
Exception in Tkinter callback
...
File Ca_canvas.py, line 173, in stupid
def stupid(unused) : disp.fill_canvas()
TypeError: fill_canvas() takes no arguments (1 given)
What is going on?
I tried to do something similar with lambda
and got the same result.
The class method needs a self argument so that
disp.fill_canvas() can parse the class instance disp
to the method.

Cheers
TG

Dec 3 '07 #2

P: n/a
Oops. I just forgot self.
Dec 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.