def __init__(self, team): self.inventory = Inventory() self.voir = None self.state = None self.level = 1 self.team = team self.messages = MessageList()
def __init__(self, applog=None, start_demo_db=False): global logging if applog is not None: logging = applog self.logging = logging self.system_id = None self.messages = MessageList(self) self.contract_type = ContractType self.contract_type.db = self self.offer = Offer self.offer.db = self self.position = Position self.position.db = self self.history = Message self.history.db = self self.graph = Graph self.graph.db = self self.demo_db_pid = None self.time_offset = 0 if start_demo_db: self.start_demo_db() self.connect() with self.conn.cursor() as curs: curs.execute("SELECT id FROM account WHERE system = true") self.system_id = int(curs.fetchone()[0])
import threading import time import tkinter as tk from userFace import UserFace from message import Message, MessageList from messageSendingAndReceive import MessageRev, MessageSend #连接服务器============ s = socket.socket() host = '127.0.0.1' port = 12345 # s.setblocking(False) firstConntectTimes = time.time() s.connect((host, port)) #创建消息对象 messageList = MessageList(10) #创建消息发送对象 ms = MessageSend(s) #创建用户界面 root = tk.Tk() uf = UserFace(root, ms) #创建消息接收线程 mr = MessageRev(s, root, uf, messageList) root.mainloop()