473,545 Members | 769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

takes no arguments (1 given)

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(fr ed, None)
disp.pack()
def stupid(unused) : disp.fill_canva s()
disp.bind("<Con figure>", stupid)
mainloop()

From the above I get:
Exception in Tkinter callback
....
File Ca_canvas.py, line 173, in stupid
def stupid(unused) : disp.fill_canva s()
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
2 17243

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(sel f):
slop=self.slop
set_sr(int(self .cget('width')) +slop,
int(self.cget(' height'))+slop)
self.refresh()
...

disp=Display(fr ed, None)
disp.pack()
def stupid(unused) : disp.fill_canva s()
disp.bind("<Con figure>", stupid)
mainloop()
>From the above I get:
Exception in Tkinter callback
...
File Ca_canvas.py, line 173, in stupid
def stupid(unused) : disp.fill_canva s()
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_canva s() can parse the class instance disp
to the method.

Cheers
TG

Dec 3 '07 #2
Oops. I just forgot self.
Dec 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
290
by: SK | last post by:
how can i get the arguments given in the command line?
26
2798
by: Martin Jørgensen | last post by:
Hi, I'm learning C-programming. I have a program which I would like to modify so it takes arguments from the commandline. Let call the program: program.exe. Could somebody shortly explain how I get this behaviour: C:>program -help or C:>program -h printf("\nBla. bla. Here is some help and arguments\n").... etc.
1
4251
by: Jean Paul Mertens | last post by:
Hello, Is there a simple way for passing arguments to applications deployed with ClickOnce and having off-line capabilities. My app takes arguments if I start it with the whole path to it "c:\whole\path\myapp.exe /arg=123" but as I do not know where the application reside on the client PC's I don't know the whole path. Is there a way...
1
2308
by: Tom Harris | last post by:
Hi, Is there a way to pass arguments to TestCases when running tests? I have a test suite that need to be configured slightly differently for 3 different products, and rather than do a hack I wondered if there was a canonical way to do it. I _know_ that py.test can do it trivially. I am rather stuck with unittest, as I have 84 testcases,...
8
2492
by: The87Boy | last post by:
I am trying to make a PHP Cli program, but there is something I do not know what to do If we take an example: php5 test.php --add Hello World I am great --delete World great --sort test.txt I want to have an array with the commands, that look like this: Array ( =Array('Hello', 'World', 'I', 'am', 'great'),
0
2293
by: James Mills | last post by:
On Fri, Oct 31, 2008 at 8:49 AM, mark floyd <emfloyd2@gmail.comwrote: Mark, this is correct behavior. You have 3 positional arguments in the function definition. You _must_ aupply _all_ 3 of them. If you wish for b to be optional, then you must give it a default value. def foo(a, b=None, c=None): print a
6
47651
by: Author | last post by:
I have class BaseClass { public BaseClass(string s1, string s2) { this.S1 = s1; this.S2 = s2; } public string S1 { get; set;}
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.