本文整理汇总了Python中Client.Client.send方法的典型用法代码示例。如果您正苦于以下问题:Python Client.send方法的具体用法?Python Client.send怎么用?Python Client.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client.Client
的用法示例。
在下文中一共展示了Client.send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: App
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import send [as 别名]
class App(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.connect_button.clicked.connect(self.start)
self.ui.send_button.clicked.connect(self.send_msg)
self.client = None
def start(self):
server = self.ui.server_text.text()
username = self.ui.user_text.text()
self.client = Client(username, server)
self.client.new_message.connect(self.print_msg)
self.ui.chat_text.setEnabled(True)
self.ui.message_text.setEnabled(True)
self.ui.send_button.setEnabled(True)
def send_msg(self):
message = self.ui.message_text.text()
self.ui.message_text.clear()
self.client.send(message)
def print_msg(self, message):
self.ui.chat_text.append(message)
示例2: print
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import send [as 别名]
print("5) Exit...")
print("")
p = input("Choose Option :")
p = int(p)
if p >= 6:
break
if p == 1:
username = input("Enter Username : ")
name = input("Enter Name : ")
email = input("Enter Email : ")
cedula = input("Enter Identity Card : ")
fecha = input("Enter Birth Date :")
imagen = input("Enter Profile pic Url : ")
usr = User(username, name, email, cedula, fecha, imagen)
s.send(usr.toString().encode('utf-8'))
enc = s.recv(1024)
res = enc.decode('utf-8')
if res == "YES":
s.send(usr.toString().encode('utf-8'))
print("User succsesfully added!!!\n")
else:
print("Error!!!!!!!!!")
elif p == 2:
username = input("Enter the Username to display : ")
username += "\n"+"ShowUser"
s.send(username.encode('utf-8'))
enc = s.recv(1024)
res = enc.decode('utf-8')