Skip to content

some changes #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions more_examples/m1e_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,30 @@ def main():
# Root (main) window
root = tkinter.Tk()
root.title('Hello!')
root.geometry("300x200")

# Frame
frame1 = ttk.Frame(root)
frame1.grid()
frame1.place(relx=0.1,rely=0.1,relheight=0.9,relwidth=0.9)

# Label
label = ttk.Label(frame1, text='This is a Label above a Button')
label.grid()
label = ttk.Label(frame1, text='This is a Label above a Button',anchor="nw",justify="center")
label.place(relx=0.1,rely=0.02,relheight=0.1,relwidth=0.9)

# Two buttons
change_title_button = ttk.Button(frame1,
text='Change the Title (above)')
change_title_button.grid()
change_title_button.place(relx=0.1,rely=0.1,relheight=0.3,relwidth=0.7)
change_title_button['command'] = lambda: change_title(root)

quit_button = ttk.Button(frame1, text='Quit')
quit_button.grid()
quit_button.place(relx=0.2,rely=0.4,relheight=0.15,relwidth=0.4)
quit_button['command'] = lambda: close_window(root)

# Another Label, with its text set another way
label2 = ttk.Label(frame1)
label2['text'] = 'Later, we will put Labels BESIDE Buttons'
label2.grid()
label2.place(relx=0.1,rely=0.6,relheight=0.1,relwidth=0.7)

root.mainloop()

Expand Down