In article
3d0bf288-fa5d-48e5-9529-db92d420a...@1g2000yqv.googlegroups.com,
Rick Johnson rantingrickjohn...@gmail.com wrote:
On Feb 29, 11:24 pm, Terry Reedy tjre...@udel.edu wrote:
On 2/29/2012 10:22 PM, Rick Johnson wrote:
PS: I would highly suggest against using the from Tkinter
On Mar 2, 4:16 pm, John Salerno johnj...@gmail.com wrote:
what is the point of creating a Frame object at all? I tried NOT
doing it, like you said, and it seemed to work fine with my simple
example. But is there a benefit to using a Frame object to group the
widgets together? Or is it cleaner
Rick Johnson rantingrickjohn...@gmail.com wrote:
Book authors and Doc authors are not always the most well informed; as
we have witnessed by this very thread! Obviously these tutorials are more
like: What NOT to do when coding Tkinter GUIs! No wonder everyone hates
Tkinter. :-)
Indeed.
Indeed. One of the things that motivated me to write the tutorial at
http://www.tkdocs.com is the rather poor state (in terms of being out of
date, incorrect, or demonstrating poor practices) of most Tkinter
documentation.
Call it self-serving, but I think the Tkinter world would be a
On 3/1/2012 10:43 PM, Terry Reedy wrote:
Not sure what is happening on your end, but i don't see any braces.
Are you saying that if you change Hello_World\n(click_me) to
Hello World\n(click me), you see
Hello World
(click me)
as I expected, instead of
{Hellow World
(click me)}
as I do
Terry Reedy wrote:
The problem was another subtle bug in the current example:
self.hi_there[text] = Hello,
The spurious comma at the end makes the value of the 'text' attribute a
one-elememt tuple and not just a string. I presume tcl-based tk handles
that in the manner appropriate
After that, you can nest as
many frames, toplevels, and blah widgets under that root window as you
so desire. Actually you don't even need a frame, you can pack
widgets directly into a Toplevel or Tk widget.
This is interesting. I completely understand your point about always calling
(and
On Thursday, March 1, 2012 1:38:08 AM UTC-6, Steven D#39;Aprano wrote:
On Wed, 29 Feb 2012 22:41:53 -0800, John Salerno wrote:
Yes. You must leave it out.
Now I'm reading a Tkinter reference at
http://infohost.nmt.edu/tcc/help/pubs/tkinter/minimal-app.html and it
has this example:
On Feb 29, 10:41 pm, John Salerno johnj...@gmail.com wrote:
I'm not sure I understand which method you are advocating. It
sounded like you said calling Tk() explicitly is a bug.
I am saying just the opposite: Allowing the module Tkinter to
implicitly create a root window IF the programmer was
On Feb 29, 11:24 pm, Terry Reedy tjre...@udel.edu wrote:
On 2/29/2012 10:22 PM, Rick Johnson wrote:
PS: I would highly suggest against using the from Tkinter import *.
Instead, use import Tkinter as tk and prefix all module contents
with tk..
I have changed the example to do that. I also
On Mar 1, 12:14 am, John Salerno johnj...@gmail.com wrote:
What exactly is the purpose of doing that? Does Tk do some extra work that
a simple call to Frame won't do?
More specifically, what is the benefit of doing:
root = tk.Tk()
app = Application(master=root)
app.mainloop()
as
On Feb 29, 11:40 pm, John Salerno johnj...@gmail.com wrote:
The faulty code is not my own, which is part of the reason I asked
the question. The book I'm reading (The Quick Python Book) does not
use it, but I saw in the Python docs that it is there, under
tkinter in the Global Module Docs,
EXAMPLE 1: (this works, but is flawed!)
root = tk.Tk()
b = tk.Button(master=None, text='Sloppy Coder')
b.pack()
root.mainloop()
EXAMPLE 2: (This is how to write code!)
root = tk.Tk()
widgetframe = tk.Frame(root)
b = tk.Button(master=None, text='Sloppy Coder')
b.pack()
On Mar 1, 9:15 pm, John Salerno johnj...@gmail.com wrote:
EXAMPLE 1: (this works, but is flawed!)
root = tk.Tk()
b = tk.Button(master=None, text='Sloppy Coder')
b.pack()
root.mainloop()
EXAMPLE 2: (This is how to write code!)
root = tk.Tk()
widgetframe = tk.Frame(root)
b
On Mar 1, 8:49 pm, Rick Johnson rantingrickjohn...@gmail.com wrote:
On Feb 29, 11:24 pm, Terry Reedy tjre...@udel.edu wrote:
On 2/29/2012 10:22 PM, Rick Johnson wrote:
PS: I would highly suggest against using the from Tkinter import *.
Instead, use import Tkinter as tk and prefix all
On 3/1/2012 9:49 PM, Rick Johnson wrote:
On Feb 29, 11:24 pm, Terry Reedytjre...@udel.edu wrote:
There is a minor problem left. The hi_there Button text has underscores
because if I use spaces instead, tk surrounds the text with {bra ces}.
This seems bizarre. Is there any way to have Button
Hmm, it seems as though i am the latest victim of the copy/paste
error! Oh well, if you were going to absorb my teachings, you would
have absorbed them by now. I am moving on unless a new subject needs
explaining.
Well, I've certainly absorbed your recommendation to always create the root
On Feb 28, 11:06 pm, John Salerno johnj...@gmail.com wrote:
The book I'm reading about using Tkinter only does this when creating the
top-level window:
app = Application()
app.mainloop()
and of course the Application class has subclassed the tkinter.Frame class.
However, in the Python
On 2/29/2012 9:24 AM, Rick Johnson wrote:
On Feb 28, 11:06 pm, John Salernojohnj...@gmail.com wrote:
However, in the Python documentation, I see this:
root = Tk()
app = Application(master=root)
app.mainloop()
root.destroy()
I tried the above and I got the following error:
Traceback
On Feb 29, 6:17 pm, Terry Reedy tjre...@udel.edu wrote:
On 2/29/2012 9:24 AM, Rick Johnson wrote:
On Feb 28, 11:06 pm, John Salernojohnj...@gmail.com wrote:
However, in the Python documentation, I see this:
root = Tk()
app = Application(master=root)
app.mainloop()
root.destroy()
It is not necessarily to call Tk explicitly, which i think is a bug
BTW. Sure, for simple scripts you can save one line of code but only
at the expense of explicitness and intuitiveness. Observe
## START CODE ##
import Tkinter as tk
root = tk.Tk()
root.title('Explicit Root')
On 2/29/2012 10:22 PM, Rick Johnson wrote:
I do not know what book the OP is referring to,
but the current doc example is
http://docs.python.org/py3k/library/tkinter.html#a-simple-hello-world-program
My current replacement (see below) can be downloaded from the tracker:
On 2/29/2012 11:41 PM, John Salerno wrote:
window? If you only want the Windows X button to close the window,
then is it okay to leave out any call to destroy()?
Yes. You must leave it out.
the latter, then where in the code do you put the call to destroy so
it won't conflict with the user
Yes, but i think the REAL problem is faulty code logic. Remove the
last line root.destroy() and the problem is solved. Obviously the
author does not have an in-depth knowledge of Tkinter.
The faulty code is not my own, which is part of the reason I asked the
question. The book I'm reading
On Wednesday, February 29, 2012 11:40:45 PM UTC-6, Terry Reedy wrote:
On 2/29/2012 11:41 PM, John Salerno wrote:
window? If you only want the Windows X button to close the window,
then is it okay to leave out any call to destroy()?
Yes. You must leave it out.
the latter, then where
What exactly is the purpose of doing that? Does Tk do some extra work that a
simple call to Frame won't do?
More specifically, what is the benefit of doing:
root = tk.Tk()
app = Application(master=root)
app.mainloop()
as opposed to:
app = Application()
app.mainloop()
Also, in the first
Yes. You must leave it out.
Now I'm reading a Tkinter reference at
http://infohost.nmt.edu/tcc/help/pubs/tkinter/minimal-app.html
and it has this example:
#!/usr/local/bin/python
from Tkinter import *
class Application(Frame):
def __init__(self, master=None):
On Wed, 29 Feb 2012 22:41:53 -0800, John Salerno wrote:
Yes. You must leave it out.
Now I'm reading a Tkinter reference at
http://infohost.nmt.edu/tcc/help/pubs/tkinter/minimal-app.html and it
has this example:
[...]
Could you please stop posting the same message twice? It's very annoying.
The book I'm reading about using Tkinter only does this when creating the
top-level window:
app = Application()
app.mainloop()
and of course the Application class has subclassed the tkinter.Frame class.
However, in the Python documentation, I see this:
root = Tk()
app =
29 matches
Mail list logo