message entry box at center

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • asit

    message entry box at center

    from Tkinter import *


    def callback():
    print e.get()


    master=Tk()
    e=Entry(master)
    e.pack(anchor=C ENTER)
    e.focus_set()


    b=Button(master ,text="get",wid th=10,command=c allback)
    b.pack(anchor=C ENTER)

    master.mainloop ()


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

    #2
    Re: message entry box at center

    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=T rue)
    e.focus_set()
    >
    >
    b=Button(master ,text="get",wid th=10,command=c allback)
    b.pack(anchor=C ENTER)
    >
    master.mainloop ()
    For more complex layouts have a look at the grid geometry manager.

    Peter

    Comment

    • asit

      #3
      Re: message entry box at center

      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=T rue)
      >
      e.focus_set()
      >
      b=Button(master ,text="get",wid th=10,command=c allback)
      b.pack(anchor=C ENTER)
      >
      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. !!

      Comment

      • Peter Otten

        #4
        Re: message entry box at center

        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",wid th=10,command=c allback)
        b.pack(anchor=C ENTER)
        >>
        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(expa nd=1)
        e = Entry(panel)
        e.pack()
        b = Button(panel, text="get")
        b.pack()

        master.mainloop ()

        Peter

        Comment

        Working...