from tkinter import * from tkinter.ttk import * root = Tk() # create button button = Button(root, text="Click Me") # place button at (100, 50) on the window button.place(x=100, y=50) root.mainloop()
from tkinter import * from tkinter.ttk import * root = Tk() # create button button = Button(root, text="Confirm", command=root.quit) # place button at center of the window button.place(relx=0.5, rely=0.5, anchor=CENTER) root.mainloop()In this example, the button widget is created with the label "Confirm" and a command to quit the window when it is clicked. The `place` method is used to center the button on the window using the `relx`, `rely`, and `anchor` options. In conclusion, the Python package library used in these examples is tkinter.ttk, which provides enhanced widgets for the tkinter GUI module. The `place` method is used to position the Button widget on the window.