message entry box at center

A

asit

from Tkinter import *


def callback():
print e.get()


master=Tk()
e=Entry(master)
e.pack(anchor=CENTER)
e.focus_set()


b=Button(master,text="get",width=10,command=callback)
b.pack(anchor=CENTER)

master.mainloop()


i want to show the entry button at the center of the window. How is it
possible ??
 
P

Peter Otten

asit said:
i want to show the entry button at the center of the window. How is it
possible ??
from Tkinter import *


def callback():
print e.get()


master=Tk()
e=Entry(master)
e.pack(expand=True)

e.focus_set()


b=Button(master,text="get",width=10,command=callback)
b.pack(anchor=CENTER)

master.mainloop()

For more complex layouts have a look at the grid geometry manager.

Peter
 
A

asit

For more complex layouts have a look at the grid geometry manager.

Peter

but here there is another problem. there is a huge gap between get
button and message entry button when maximized.

pl z help. !!
 
P

Peter Otten

but here there is another problem. there is a huge gap between get
button and message entry button when maximized.

Here are two more variants:

# large Entry widget
from Tkinter import *

master = Tk()
e = Entry(master)
e.pack(expand=1, fill=BOTH)
b = Button(master, text="get")
b.pack()

master.mainloop()

# nested Frame widget
from Tkinter import *

master = Tk()
panel = Frame(master)
panel.pack(expand=1)
e = Entry(panel)
e.pack()
b = Button(panel, text="get")
b.pack()

master.mainloop()

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top