def __init__(self, game, stack): self.game = game self.stack = stack self.canvas = game.canvas self.bindings = [] font = game.app.getFont('canvas_small') # print self.app.cardset.CARDW, self.app.images.CARDW cardw = game.app.images.CARDW x, y = stack.x+cardw/2, stack.y text = stack.getHelp()+'\n'+stack.getBaseCard() text = text.strip() if text: frame = tkinter.Frame(self.canvas) self.frame = frame label = tkinter.Message(frame, font=font, text=text, width=cardw-8, relief='solid', fg='#000000', bg='#ffffe0', bd=1) label.pack() self.label = label self.id = self.canvas.create_window(x, y, window=frame, anchor='n') self.bindings.append( label.bind('<ButtonPress>', self._buttonPressEvent)) # self.bindings.append(label.bind('<Enter>', self._enterEvent)) else: self.id = None
def create_parameter_frame(self): """ Define the parameter window """ #print("dbg414: create_parameter_frame") self.frame_c = tkinter.Toplevel(self.frame_a) self.frame_c.title("parameter info") self.parameter_message = tkinter.Message(self.frame_c, textvariable=self.parameter_content) self.parameter_message.grid(sticky=tkinter.N+tkinter.E+tkinter.S+tkinter.W) self.frame_c.protocol("WM_DELETE_WINDOW", self.hide_parameter_frame) # change the behaviour of the window X button