class TableMainFrame(wx.Frame): def __init__(self, src_path): # match = re.search('\((\d+)\)', os.path.basename(src_path)) match = re.search("\w+ (\w+)", os.path.basename(src_path)) self.id = match.group(1) wx.Frame.__init__(self, wx.GetApp().TopWindow, wx.NewId(), "Table") self.players = [None] * 10 self.file = open(src_path) self.window = WindowMgr(self.id) self.boxes = [] x, y = self.window.get_rect()[0:2] self.SetPosition((x, y)) for i in range(10): box = StayOnTopFrame(self, i) x_off, y_off = seat_cords[i] box.SetPosition((x + x_off, y + y_off)) self.boxes.append(box) self.Show() self.on_timer() self.update() def on_timer(self): # delta_pos = wx.Point(*self.window.get_rect()[0:2]) - self.GetPosition() # self.Move(self.GetPosition() + delta_pos) # for box in self.boxes: # box.Move(box.GetPosition() + delta_pos) x, y, w, h = self.window.get_rect() w, h = w - x, h - y for i, box in enumerate(self.boxes): box.SetPosition((int(x + (w * seat_cords[i][0])), int(y + (h * seat_cords[i][1])))) wx.CallLater(10, self.on_timer) def update(self): hand = self.file.readlines() players = handparse.parse_hand(hand) self.players = [x if x else self.players[i] for i, x in enumerate(players)] for seat, box in enumerate(self.boxes): box.update(self.players[seat])
def __init__(self, src_path): # match = re.search('\((\d+)\)', os.path.basename(src_path)) match = re.search("\w+ (\w+)", os.path.basename(src_path)) self.id = match.group(1) wx.Frame.__init__(self, wx.GetApp().TopWindow, wx.NewId(), "Table") self.players = [None] * 10 self.file = open(src_path) self.window = WindowMgr(self.id) self.boxes = [] x, y = self.window.get_rect()[0:2] self.SetPosition((x, y)) for i in range(10): box = StayOnTopFrame(self, i) x_off, y_off = seat_cords[i] box.SetPosition((x + x_off, y + y_off)) self.boxes.append(box) self.Show() self.on_timer() self.update()