我如何从右到左定位框架没有边距

how can i position frame right to left hasn't margin

我想将右侧文本框定位到左侧,然后注销按钮位置不应移动任何位置 '''

from tkinter import *

# container window
root = Tk()

# frame
frame = Frame(root)

# content of the frame
frame.text = Text(root)
frame.text.insert('1.0', 'Geeks for Geeks')

frame.text.pack_propagate(True)
# to add margin to the frame
frame.text.grid(row=0, column=1,
                pady=20)
# simple button
frame.quitw = Button(root)
frame.quitw["text"] = "Logout",
frame.quitw["command"] = root.quit
frame.quitw.grid(row=1, column=0, padx=100)
frame.quitw.pack_propagate(True)
root.mainloop()

'''

您可以将小部件放在同一列中:

from tkinter import *

# container window
root = Tk()

# frame
frame = Frame(root)

# content of the frame
frame.text = Text(root)
frame.text.insert('1.0', 'Geeks for Geeks')

frame.text.pack_propagate(True)
# to add margin to the frame
frame.text.grid(row=0, column=1,
                pady=20)
# simple button
frame.quitw = Button(root)
frame.quitw["text"] = "Logout",
frame.quitw["command"] = root.quit
frame.quitw.grid(row=1, column=1, padx=100)
frame.quitw.pack_propagate(True)
root.mainloop()