def add_button(self, b, r, c, frames, col=None): if platform.system() in ["Darwin"]: kwargs = { "activebackground": self.colors["inactive"], "borderless": True, "height": 50, "width": 70, } else: kwargs = {"height": 4, "width": 10} f = Frame(frames[b + 2], bg=self.colors["bg"]) f.grid(row=r, column=c) bt = Button(f, text=col[2] if col else '', bg=self.colors["inactive"], **kwargs) self.w_buttons[b].append(bt) if col: key = col[2] if key == "\\": key = "backslash" self.bind( f"<KeyPress-{key}>", lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self. button_press_repeat(rowx, colx, bankx, *args, **kwargs), ) self.bind( f"<KeyRelease-{key}>", lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self. button_release_repeat(rowx, colx, bankx, *args, **kwargs), ) bt.bind( "<ButtonPress>", lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self.button_press( rowx, colx, bankx, *args, **kwargs), ) bt.bind( "<ButtonRelease>", lambda *args, rowx=r, colx=c, bankx=b, **kwargs: self. button_release(rowx, colx, bankx, *args, **kwargs), ) bt.pack(side=TOP, fill=X) if col: lb = Label(f, text=col[0] if col else '', bg=self.colors["bg"]) lb.pack(side=TOP, fill=X) lb = Label(f, text=col[1] if col else '', bg=self.colors["bg"]) lb.pack(side=TOP, fill=X)
listbox.insert(tk.END, "Usable Balance Is: {:.8f}".format( usable_balance)) #PRINT USABLE BALANCE #listbox.insert(tk.END,"Unused TXNs") #PRINT UNUSED TXNS #wallet.list_utxos(node) #PRINT UTXOS command_entry.delete(0, tk.END) frame_bottom = tk.Frame() command_entry = tk.Entry(master=frame_bottom) command_entry.pack(fill=tk.X, side=tk.LEFT, expand=True) command_submit = Button(master=frame_bottom, text="Submit") command_submit.pack() command_submit.bind("<Button-1>", command_click) #frame_top.pack() #frame_2.pack(fill=tk.BOTH) frame_3.pack(fill=tk.BOTH, expand=True) frame_bottom.pack(fill=tk.X) window.mainloop()
dealer_cards_frame=dealer_cards_frame, deal_results_frame=deal_results_frame, player_busted_message=player_busted_message, dealer_busted_message=dealer_busted_message, split=split) # Starting operations in real game: #deal player: game.deal_player() #deal for dealer: #handle all dealt cards for dealer for here so we can keep one undisplayed dealer_1 = game.get_card(dealer_card1_label, is_player=False) dealer_2 = game.get_card(dealer_card2_label, is_player=False, display=False) #fill the score board: game.set_scoreboard() #See if split should be disabled or enabled: game.set_split_button_state() #Set the Buttons click function <Button-1> Stand for left click hit.bind('<Button-1>', lambda event: game.hit(dealer_2)) stand.bind('<Button-1>', lambda event: game.finish_player_turn(dealer_2)) deal.bind('<Button-1>', lambda event: deal_init()) root.mainloop()
activebackground='green') # button_26 = Button(frame1, text='Pause Preset', relief=GROOVE, borderwidth=5, padx=30, pady=20, command=) # button_27 = Button(frame1, text='Stop Preset', relief=GROOVE, borderwidth=5, padx=30, pady=20, command=) #showing frame1 frame1.grid(row=0, column=0, padx=20) #showing buttons for frame1 button_1.pack(pady=10) button_2.pack(pady=10) button_3.pack(pady=10) button_4.pack(pady=10) button_5.pack(pady=10) # button_26.pack(pady=10) # button_27.pack(pady=10) button_3.bind("<Key>", pressed) # pressed = False # button_5.bind("<Button-1>", play) # button_5.bind_all("<Key>", play) # button_4.bind("<Button-1>", press) # button_4.bind("<ButtonRelease-1>", release) # button_4.bind_all("<Key>", play) # button_1.bind_all("<Key>", threading.Thread(target=play).start()) # def hitkey(event): # my_label = Label(root, text='You clicked this button' + event.char) # my_label.pack() # myButton = Button(root, text="Click me") # myButton.bind_all("<Key>", hitkey) # myButton.pack(pady=20)