Hi,
Im trying to write an irc client with python. This is its login page(i hope it will be)
#!usr/bin/env python
# -*- coding: utf8 -*-
import gtk, sys, socket
class PyApp(gtk.Window):
def con(self):
iserver = self.entry.get_text()
inick = self.entry2.get_text()
room = self.entry3.get_text()
password = self.entry4.get_text()
socket.server = iserver
socket.nick = inick
socket.channel = ichannel
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
irc.connect((iserver, 6667))
irc.send('NICK %s\r\n' % inick)
irc.send('USER X 0 * : gms\r\n')
irc.send('JOIN %s\r\n' % ichannel)
def __init__(self):
super(PyApp, self).__init__()
self.set_title("Gms-irc")
self.set_size_request(360, 200)
self.set_position(gtk.WIN_POS_CENTER)
fixed = gtk.Fixed()
self.label = gtk.Label("Server:")
fixed.put(self.label, 20, 20)
self.label = gtk.Label("Nick:")
fixed.put(self.label, 20, 50)
self.label = gtk.Label("Room:")
fixed.put(self.label, 20, 80)
self.label = gtk.Label("Password:")
fixed.put(self.label, 20, 110)
self.entry = gtk.Entry()
fixed.put(self.entry, 140, 20)
self.entry2 = gtk.Entry()
fixed.put(self.entry2, 140, 50)
self.entry3 = gtk.Entry()
fixed.put(self.entry3, 140, 80)
self.entry4 = gtk.Entry()
fixed.put(self.entry4, 140, 110)
self.btn1 = gtk.Button("Connect!")
self.btn1.connect("clicked", self.con)
fixed.put(self.btn1, 80, 150)
self.add(fixed)
self.show_all()
PyApp()
gtk.main()
its not finished yet, when i run script i take error that "TypeError: con() takes exactly 1 argument (2 given)" couldnt fix that. can any1 help me?