Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello guys.Iam new ,I have a problem with tkinter in pytho3.I want to put "Confirm" button next to Entry.How can I do it easy?


Thanks.


What I have tried:

from tkinter import *
import tkinter.font as tkFont
root = Tk()

def Password(root , unlock_message , access_camera):    

    activate_message = "SYSTEM ACTIVATED"
    denied_message = "ACCESS DENIED"

    size_letter = tkFont.Font(family = "Helvetica" , size = 24 , weight = "bold")
    message_box = Label(root , text = "Passcode required to " + unlock_message + " system" , padx = 500 , font = size_letter)
    message_box.grid(row = 0 , column = 0)

    input_box = Entry(root , show = "*" , width = 6 , font = ('Verdana' , 20) ).grid(row = 1 , column = 0)
    enter_password_button = Button(root , text = "Confirm"  , pady = 8).grid(row = 1 , column = 1)

    
root.geometry("1800x1100")
root.title("Vehicle app")
Password(root , "unlock" , True)

root.mainloop()
Posted
Updated 16-Feb-21 3:06am
v2
Comments
Richard MacCutchan 16-Feb-21 6:25am    
What is wrong with the above code?

1 solution

Python
message_box = Label(root , text = "Passcode required to " + unlock_message + " system" , padx = 500 , font =

The padx clause in the above line is moving the button off the edge of the window. If you remove it the button will become visible. You should not use absolute values to position your controls as they are not able to take account of different screen/window sizes. Position your controls relative to the root window and each other.
 
Share this answer
 
Comments
Snape9 16-Feb-21 12:51pm    
THANK YOU BRO !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900