python - in python2.7 how to align the text with the button -


in python 2.7 i'm trying align text frankie anne next name button , 27 next age button can them in center far. tried left , bottom didn't work. helpful.

from tkinter import *  root = tk()  toolbar = frame(root)  b = button(toolbar, text="home", width=9) b.pack(side=left, padx=2, pady=2)  b = button(toolbar, text="about-us", width=9) b.pack(side=left, padx=2, pady=2)  b = button(toolbar, text="contact-us", width=9) b.pack(side=left, padx=2, pady=2)  b = button(toolbar, text="travelling", width=9) b.pack(side=left, padx=2, pady=2)    toolbar.pack(side=top, fill=x)  o = label(root,text="frank anne",font =("italic",18,"bold")) o.pack() toolbar1 = frame(root) b = button(toolbar1, text="name",width=9) b.pack(side=left, padx=2, pady=2)  o = label(root,text="27",font =("italic",10,"bold")) o.pack()  o = label(root,text="frankie anne",font =("italic",10,"bold")) o.pack(side=top, padx=0, pady=0)   toolbar1.pack(side=bottom, fill=x)   toolbar2 = frame(root) b = button(toolbar2, text="age",width=9) b.pack(side=left, padx=2, pady=2) b.pack(side=bottom, padx=2, pady=2)    toolbar2.pack(side=bottom, fill=x)  mainloop() 

you can add side=left objects , intersparce \n in texts make new lines. i'm little confused on why have toolbar2 age button when age text part of toolbar 1. group depending on want.


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -