467,915 Members | 1,815 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

message entry box at center

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=callba ck)
b.pack(anchor=CENTER)

master.mainloop()
i want to show the entry button at the center of the window. How is it
possible ??
Feb 28 '08 #1
  • viewed: 1333
Share:
3 Replies
asit wrote:
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=callba ck)
b.pack(anchor=CENTER)

master.mainloop()
For more complex layouts have a look at the grid geometry manager.

Peter
Feb 28 '08 #2
On Feb 28, 7:53 pm, Peter Otten <__pete...@web.dewrote:
asit wrote:
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=callba ck)
b.pack(anchor=CENTER)
master.mainloop()

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. !!
Feb 28 '08 #3
asit wrote:
On Feb 28, 7:53 pm, Peter Otten <__pete...@web.dewrote:
>asit wrote:
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=callba ck)
b.pack(anchor=CENTER)
master.mainloop()

For more complex layouts have a look at the grid geometry manager.
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
Feb 28 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mickel Grönroos | last post: by
5 posts views Thread by Thomas Scheiderich | last post: by
4 posts views Thread by dave | last post: by
6 posts views Thread by mhmtzdmr | last post: by
8 posts views Thread by DP | last post: by
2 posts views Thread by isaac2004 | last post: by
10 posts views Thread by Lung.S.wu | last post: by
1 post views Thread by togforev | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.