Setting Window Size using Pack Under Tkinter

Discussion in 'Python' started by Fuzzyman, Jan 16, 2004.

  1. Fuzzyman

    Fuzzyman Guest

    I'm having trouble implementing my GUI using Tkinter......
    I've been working through the Tkinter tutorials from 'Programming
    Python' and am generally happy enough with the functionality and feel
    of the results *but* - I can't see how to set the size of the root
    window (or any top level window) and to stop it being resized........

    Thanks for any help.

    Fuzzyman


    --

    YAPLP
    Yet Another Python Links Page
    http://www.voidspace.org.uk/coollinks/python_links.shtml

    Python Utils
    http://www.voidspace.org.uk/atlantibots/pythonutils.html

    --

    http://www.Voidspace.org.uk
    The Place where headspace meets cyberspace. Online resource site -
    covering science, technology, computing, cyberpunk, psychology,
    spirituality, fiction and more.

    ---
    http://www.atlantibots.org.uk
    http://groups.yahoo.com/group/atlantis_talk/
    Atlantibots - stomping across the worlds of Atlantis.
    ---
    http://www.fuchsiashockz.co.uk
    http://groups.yahoo.com/group/void-shockz
    ---

    Everyone has talent. What is rare is the courage to follow talent
    to the dark place where it leads. -Erica Jong
    Ambition is a poor excuse for not having sense enough to be lazy.
    -Milan Kundera
     
    Fuzzyman, Jan 16, 2004
    #1
    1. Advertising

  2. Fuzzyman

    duikboot Guest

    from Tkinter import *
    gui=Tk()

    ####code####
    gui.geometry("+%d+%d" %(300, 100))
    gui.resizable(0,0)

    if __name__=='__main__':
    gui.mainloop()




    "Fuzzyman" <> schreef in bericht
    news:...
    > I'm having trouble implementing my GUI using Tkinter......
    > I've been working through the Tkinter tutorials from 'Programming
    > Python' and am generally happy enough with the functionality and feel
    > of the results *but* - I can't see how to set the size of the root
    > window (or any top level window) and to stop it being resized........
    >
    > Thanks for any help.
    >
    > Fuzzyman
    >
    >
    > --
    >
    > YAPLP
    > Yet Another Python Links Page
    > http://www.voidspace.org.uk/coollinks/python_links.shtml
    >
    > Python Utils
    > http://www.voidspace.org.uk/atlantibots/pythonutils.html
    >
    > --
    >
    > http://www.Voidspace.org.uk
    > The Place where headspace meets cyberspace. Online resource site -
    > covering science, technology, computing, cyberpunk, psychology,
    > spirituality, fiction and more.
    >
    > ---
    > http://www.atlantibots.org.uk
    > http://groups.yahoo.com/group/atlantis_talk/
    > Atlantibots - stomping across the worlds of Atlantis.
    > ---
    > http://www.fuchsiashockz.co.uk
    > http://groups.yahoo.com/group/void-shockz
    > ---
    >
    > Everyone has talent. What is rare is the courage to follow talent
    > to the dark place where it leads. -Erica Jong
    > Ambition is a poor excuse for not having sense enough to be lazy.
    > -Milan Kundera
     
    duikboot, Jan 16, 2004
    #2
    1. Advertising

  3. Fuzzyman

    duikboot Guest

    from Tkinter import *
    gui=Tk()

    ####code####
    gui.geometry("+%d+%d" %(300, 100))
    gui.resizable(0,0)
    gui.mainloop()

    Will work offcourse too.. :)

    cheers,

    Arjen



    "duikboot" <> schreef in bericht
    news:4007de09$0$151$4all.nl...
    > from Tkinter import *
    > gui=Tk()
    >
    > ####code####
    > gui.geometry("+%d+%d" %(300, 100))
    > gui.resizable(0,0)
    >
    > if __name__=='__main__':
    > gui.mainloop()
    >
    >
    >
    >
    > "Fuzzyman" <> schreef in bericht
    > news:...
    > > I'm having trouble implementing my GUI using Tkinter......
    > > I've been working through the Tkinter tutorials from 'Programming
    > > Python' and am generally happy enough with the functionality and feel
    > > of the results *but* - I can't see how to set the size of the root
    > > window (or any top level window) and to stop it being resized........
    > >
    > > Thanks for any help.
    > >
    > > Fuzzyman
    > >
    > >
    > > --
    > >
    > > YAPLP
    > > Yet Another Python Links Page
    > > http://www.voidspace.org.uk/coollinks/python_links.shtml
    > >
    > > Python Utils
    > > http://www.voidspace.org.uk/atlantibots/pythonutils.html
    > >
    > > --
    > >
    > > http://www.Voidspace.org.uk
    > > The Place where headspace meets cyberspace. Online resource site -
    > > covering science, technology, computing, cyberpunk, psychology,
    > > spirituality, fiction and more.
    > >
    > > ---
    > > http://www.atlantibots.org.uk
    > > http://groups.yahoo.com/group/atlantis_talk/
    > > Atlantibots - stomping across the worlds of Atlantis.
    > > ---
    > > http://www.fuchsiashockz.co.uk
    > > http://groups.yahoo.com/group/void-shockz
    > > ---
    > >
    > > Everyone has talent. What is rare is the courage to follow talent
    > > to the dark place where it leads. -Erica Jong
    > > Ambition is a poor excuse for not having sense enough to be lazy.
    > > -Milan Kundera

    >
    >
     
    duikboot, Jan 16, 2004
    #3
  4. Fuzzyman

    Fuzzyman Guest

    Short of actually trying it...... (when I get home I *will* try it)

    Would the following work :

    from Tkinter import *
    gui=Tk()
    Button(gui, text='A button', command=a_function).pack()

    ####code####
    gui.geometry("+%d+%d" %(300, 100))
    gui.resizable(0,0)
    gui.mainloop()

    ??

    If I recall correctly it ought to.... (mixing the pack and geometry
    methods in the same GUI)...

    Anyway - thanks.

    Fuzzy


    "duikboot" <> wrote in message news:<4007dedc$0$166$4all.nl>...
    > from Tkinter import *
    > gui=Tk()
    >
    > ####code####
    > gui.geometry("+%d+%d" %(300, 100))
    > gui.resizable(0,0)
    > gui.mainloop()
    >
    > Will work offcourse too.. :)
    >
    > cheers,
    >
    > Arjen
    >
    >
    >
    > "duikboot" <> schreef in bericht
    > news:4007de09$0$151$4all.nl...
    > > from Tkinter import *
    > > gui=Tk()
    > >
    > > ####code####
    > > gui.geometry("+%d+%d" %(300, 100))
    > > gui.resizable(0,0)
    > >
    > > if __name__=='__main__':
    > > gui.mainloop()
    > >
    > >
    > >
    > >
    > > "Fuzzyman" <> schreef in bericht
    > > news:...
    > > > I'm having trouble implementing my GUI using Tkinter......
    > > > I've been working through the Tkinter tutorials from 'Programming
    > > > Python' and am generally happy enough with the functionality and feel
    > > > of the results *but* - I can't see how to set the size of the root
    > > > window (or any top level window) and to stop it being resized........
    > > >
    > > > Thanks for any help.
    > > >
    > > > Fuzzyman
    > > >
    > > >
    > > > --
    > > >
    > > > YAPLP
    > > > Yet Another Python Links Page
    > > > http://www.voidspace.org.uk/coollinks/python_links.shtml
    > > >
    > > > Python Utils
    > > > http://www.voidspace.org.uk/atlantibots/pythonutils.html
    > > >
    > > > --
    > > >
    > > > http://www.Voidspace.org.uk
    > > > The Place where headspace meets cyberspace. Online resource site -
    > > > covering science, technology, computing, cyberpunk, psychology,
    > > > spirituality, fiction and more.
    > > >
    > > > ---
    > > > http://www.atlantibots.org.uk
    > > > http://groups.yahoo.com/group/atlantis_talk/
    > > > Atlantibots - stomping across the worlds of Atlantis.
    > > > ---
    > > > http://www.fuchsiashockz.co.uk
    > > > http://groups.yahoo.com/group/void-shockz
    > > > ---
    > > >
    > > > Everyone has talent. What is rare is the courage to follow talent
    > > > to the dark place where it leads. -Erica Jong
    > > > Ambition is a poor excuse for not having sense enough to be lazy.
    > > > -Milan Kundera

    > >
    > >
     
    Fuzzyman, Jan 19, 2004
    #4
  5. Fuzzyman

    Eric Brunel Guest

    Fuzzyman wrote:
    > Short of actually trying it...... (when I get home I *will* try it)
    >
    > Would the following work :
    >
    > from Tkinter import *
    > gui=Tk()
    > Button(gui, text='A button', command=a_function).pack()
    >
    > ####code####
    > gui.geometry("+%d+%d" %(300, 100))
    > gui.resizable(0,0)
    > gui.mainloop()
    >
    > ??


    Yes it will. Note however that doing gui.geometry("+300+100") will actually move
    the window, not resize it. To resize the window, use gui.geometry("300x100")

    More generally, the syntax for the geometry is "WxH+X+Y" where W and H are the
    window's width and height resp. and X & Y the coordinates of its top-left corner
    from the top-left corner of the screen.

    > If I recall correctly it ought to.... (mixing the pack and geometry
    > methods in the same GUI)...
    >
    > Anyway - thanks.
    >
    > Fuzzy
    >
    >
    > "duikboot" <> wrote in message news:<4007dedc$0$166$4all.nl>...
    >
    >>from Tkinter import *
    >> gui=Tk()
    >>
    >> ####code####
    >> gui.geometry("+%d+%d" %(300, 100))
    >> gui.resizable(0,0)
    >> gui.mainloop()
    >>
    >>Will work offcourse too.. :)
    >>
    >>cheers,
    >>
    >>Arjen
    >>
    >>
    >>
    >>"duikboot" <> schreef in bericht
    >>news:4007de09$0$151$4all.nl...
    >>
    >>>from Tkinter import *
    >>>gui=Tk()
    >>>
    >>>####code####
    >>>gui.geometry("+%d+%d" %(300, 100))
    >>>gui.resizable(0,0)
    >>>
    >>>if __name__=='__main__':
    >>> gui.mainloop()
    >>>
    >>>
    >>>
    >>>
    >>>"Fuzzyman" <> schreef in bericht
    >>>news:...
    >>>
    >>>>I'm having trouble implementing my GUI using Tkinter......
    >>>>I've been working through the Tkinter tutorials from 'Programming
    >>>>Python' and am generally happy enough with the functionality and feel
    >>>>of the results *but* - I can't see how to set the size of the root
    >>>>window (or any top level window) and to stop it being resized........
    >>>>
    >>>>Thanks for any help.
    >>>>
    >>>>Fuzzyman
    >>>>
    >>>>
    >>>>--
    >>>>
    >>>>YAPLP
    >>>>Yet Another Python Links Page
    >>>>http://www.voidspace.org.uk/coollinks/python_links.shtml
    >>>>
    >>>>Python Utils
    >>>>http://www.voidspace.org.uk/atlantibots/pythonutils.html
    >>>>
    >>>>--
    >>>>
    >>>>http://www.Voidspace.org.uk
    >>>>The Place where headspace meets cyberspace. Online resource site -
    >>>>covering science, technology, computing, cyberpunk, psychology,
    >>>>spirituality, fiction and more.
    >>>>
    >>>>---
    >>>>http://www.atlantibots.org.uk
    >>>>http://groups.yahoo.com/group/atlantis_talk/
    >>>>Atlantibots - stomping across the worlds of Atlantis.
    >>>>---
    >>>>http://www.fuchsiashockz.co.uk
    >>>>http://groups.yahoo.com/group/void-shockz
    >>>>---
    >>>>
    >>>>Everyone has talent. What is rare is the courage to follow talent
    >>>>to the dark place where it leads. -Erica Jong
    >>>>Ambition is a poor excuse for not having sense enough to be lazy.
    >>>> -Milan Kundera
    >>>
    >>>



    --
    - Eric Brunel <eric dot brunel at pragmadev dot com> -
    PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
     
    Eric Brunel, Jan 19, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josh
    Replies:
    1
    Views:
    2,278
    furliz
    Jul 31, 2003
  2. Tim Jones
    Replies:
    0
    Views:
    387
    Tim Jones
    Jan 31, 2004
  3. Put 030516 in email subj to get thru

    Setting applet window size using javascript?

    Put 030516 in email subj to get thru, Oct 24, 2003, in forum: Javascript
    Replies:
    2
    Views:
    247
    Put 030516 in email subj to get thru
    Oct 25, 2003
  4. Alexander Farber

    pack 'C3U*' not same as pack 'C3(xC)*'

    Alexander Farber, Jun 23, 2005, in forum: Perl Misc
    Replies:
    2
    Views:
    142
    Ilmari Karonen
    Jun 23, 2005
  5. jodleren

    Getting picture size/setting window size

    jodleren, Feb 14, 2007, in forum: Javascript
    Replies:
    2
    Views:
    160
    jodleren
    Feb 15, 2007
Loading...

Share This Page