Navneet wrote:
One more thing I want to add here is, I am trying to create the GUI
based chat server.(Attached the programs.)
Please do not send large chunks of code like this, unless asked. Instead, you
should try to produce a minimal example that demonstrates the problem. It
should be:
* short (avoid code which has nothing to do with the problem)
* self-contained (other people must be able to run it)
* correct (it must actually fail in the way you say it fails)
See here for more: http://sscce.org/
In cutting your code down to a minimal example, 9 times out of 10 you will
solve your problem yourself, and learn something in the process.
bash-3.1$ python Client1.py
Enter the server address:...9009
Traceback (most recent call last):
File "Client1.py", line 53, in <module>
c = ClientChat(serverport)
File "Client1.py", line 24, in __init__
gui.callGui()
File "a:\FedEx\Exp\ClientGui.py", line 37, in callGui
sendbutton =Button(f2, width = 5, height = 2, text = "Send", command
= C.ClientChat.senddata())
TypeError: unbound method senddata() must be called with ClientChat
instance as first argument (got nothing instead)
This one is easy. You need to initialize a ClientChat instance first. This may
be as simple as:
command = C.ClientChat().senddata
although I'm not sure if ClientChat requires any arguments.
Note that you call the ClientChat class, to create an instance, but you DON'T
call the senddata method, since you want to pass the method itself as a
callback function. The button will call it for you, when needed.
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor