Home > front end >  How do I put tk button on the top RIGHT
How do I put tk button on the top RIGHT

Time:12-09

I can't put the button on the top right

The code on TOP RIGHT is an err

photo = PhotoImage(file = "cross-mark (Custom).png")
Button(root, text = 'Click Me !', image = photo).pack(side = TOP RIGHT)

The code err photo

CodePudding user response:

side just accept one of the four directions available, in your case if you want it to align to the top right you should also include the anchor flag, which accept the points of a compass, in your case if you should try

Button(root, text = 'Click Me !', image = photo).pack(side = TOP, anchor = NE)

CodePudding user response:

Cannot use both Top and RIGHT.

Change this:

Button(root, text = 'Click Me !', image = photo).pack(side = TOP RIGHT)

to:

Button(root, text = 'Click Me !', image = photo).pack(side = RIGHT)
  • Related