Create a button

    btn_button1 = Button(root, text = "Button 1", fg = "black", command=btn_button1_clicked)
    btn_button1.place(x=400, y=30)
Respond to a button press
#****************************************
#****************************************
#*********** BUTTON 1 CLICKED ***********
#****************************************
#****************************************
def btn_button1_clicked():
    #Do something...

Up Down Left Right buttons example

    #Label
    lbl_loadcell_weight = Label(root, text = "?g",
                                bg="white", relief="groove",
                                width=8,
                                borderwidth=2,
                                font=('', 12, 'bold'))    #'normal', 'bold', etc)
    lbl_loadcell_weight.place(x=0, y=30)

    #Down button
    btn_weight_value_down = Button(root, text = "▼", fg = "black", width=2, command=btn_weight_down_clicked)
    btn_weight_value_down.place(x=86, y=29)
    
    #Up button
    btn_weight_value_up = Button(root, text = "▲", fg = "black", width=2, command=btn_weight_up_clicked)
    btn_weight_value_up.place(x=110, y=29)
    
    #Left button
    btn_weight_value_left = Button(root, text = "◀", fg = "black", width=2, command=btn_weight_left_clicked)
    btn_weight_value_left.place(x=86, y=54)
    
    #Right button
    btn_weight_value_right = Button(root, text = "▶", fg = "black", width=2, command=btn_weight_right_clicked)
    btn_weight_value_right.place(x=110, y=54)
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *