Re: Learning tkinter

2023-05-18 Thread MRAB

On 2023-05-12 09:55, Rob Cliffe via Python-list wrote:

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class
(tkinter.messagebox).
But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
  >>> import tkinter
  >>> tkinter.messagebox
Traceback (most recent call last):
    File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
  >>>

Why is this?


It's a submodule of tkinter:

>>> import tkinter.messagebox as mb
>>> mb.showinfo


--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Mats Wichmann

On 5/18/23 08:50, Jim Schwartz wrote:

This works for me.  Hope it helps.

from tkinter import messagebox

messagebox.showerror("Hi", f"Hello World")


It's probably instructive that IDLE always brings it in this way.

Lib/idlelib/config_key.py:from tkinter import messagebox
Lib/idlelib/configdialog.py:from tkinter import messagebox
Lib/idlelib/editor.py:from tkinter import messagebox
... etc


--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Thomas Passin

On 5/18/2023 9:13 AM, Grant Edwards wrote:

On 2023-05-12, Rob Cliffe via Python-list  wrote:


Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import tkinter
tkinter.messagebox

Traceback (most recent call last):
    File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'




$ python
Python 3.11.3 (main, May  8 2023, 09:00:54) [GCC 12.2.1 20230428] on linux
Type "help", "copyright", "credits" or "license" for more information.

import tkinter
from tkinter import messagebox
messagebox








Why is this?


Dunno.


tkinter is a package, messagebox is a module within the tkinter package. 
the messagebox module has some functions, such as showinfo(). You *can* 
import those functions using "dot" expressions:


>>> from tkinter.messagebox import showinfo


You can also import the entire module using the "dot" syntax:

>>> import tkinter.messagebox
>>> messagebox.showinfo


Whether you can directly ask for tkinter.messagebox depends on whether 
it's been defined or imported in tkinter/__init__.py.




--
https://mail.python.org/mailman/listinfo/python-list


RE: Learning tkinter

2023-05-18 Thread Jim Schwartz
This works for me.  Hope it helps.

from tkinter import messagebox

messagebox.showerror("Hi", f"Hello World")

-Original Message-
From: Python-list  On 
Behalf Of Rob Cliffe via Python-list
Sent: Friday, May 12, 2023 3:55 AM
To: Python 
Subject: Learning tkinter

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class 
(tkinter.messagebox).
But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit 
(Intel)] on win32 Type "help", "copyright", "credits" or "license" for more 
information.
 >>> import tkinter
 >>> tkinter.messagebox
Traceback (most recent call last):
   File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
 >>>

Why is this?
TIA
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Chris Angelico
On Thu, 18 May 2023 at 19:15, Rob Cliffe via Python-list
 wrote:
>
> I am trying to learn tkinter.
> Several examples on the internet refer to a messagebox class
> (tkinter.messagebox).
> But:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter
>  >>> tkinter.messagebox
> Traceback (most recent call last):
>File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
>  >>>
>
> Why is this?

Is it possible that you've created a tkinter.py for your own tinkering?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Oscar Benjamin
On Thu, 18 May 2023 at 10:16, Rob Cliffe via Python-list
 wrote:
>
> I am trying to learn tkinter.
> Several examples on the internet refer to a messagebox class
> (tkinter.messagebox).
> But:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter
>  >>> tkinter.messagebox
> Traceback (most recent call last):
>File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
>  >>>
>
> Why is this?

Do you have a file called tkinter.py in the current directory?

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Grant Edwards
On 2023-05-12, Rob Cliffe via Python-list  wrote:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> tkinter.messagebox
> Traceback (most recent call last):
>    File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
> >>>

$ python
Python 3.11.3 (main, May  8 2023, 09:00:54) [GCC 12.2.1 20230428] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> from tkinter import messagebox
>>> messagebox

>>> 


> Why is this?

Dunno.
-- 
https://mail.python.org/mailman/listinfo/python-list


Learning tkinter

2023-05-18 Thread Rob Cliffe via Python-list

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class 
(tkinter.messagebox).

But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> tkinter.messagebox
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
>>>

Why is this?
TIA
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-07 Thread Terry Reedy

On 12/6/2020 5:59 AM, Terry Reedy wrote:

On 12/6/2020 3:11 AM, Sibylle Koczian wrote:

Am 05.12.2020 um 19:56 schrieb Paulo da Silva:



Why this example does not work?
--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)

...

mainloop()



Shouldn't that be
root.mainloop()
?


Yes.  The * import does not turn method into module functions.


But no, sort of.  MRAB is correct that there is (an undocumented) module 
function by the same name.  It calls tkinter._default_root.tk.mainloop 
if _default_root is not None.  This is true if 
tkinter._support_default_root == 1 (the default, but set to 0 in IDLE) 
and tkinter.Tk has been called at least once.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-06 Thread Terry Reedy

On 12/6/2020 3:11 AM, Sibylle Koczian wrote:

Am 05.12.2020 um 19:56 schrieb Paulo da Silva:



Why this example does not work?
--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)

...

mainloop()



Shouldn't that be
root.mainloop()
?


Yes.  The * import does not turn method into module functions.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-06 Thread Sibylle Koczian

Am 06.12.2020 um 15:19 schrieb MRAB:

On 2020-12-06 08:11, Sibylle Koczian wrote:

Am 05.12.2020 um 19:56 schrieb Paulo da Silva:

Hi!

Why this example does not work?

--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)

...

mainloop()
-



Shouldn't that be

root.mainloop()

?


The function 'mainloop' calls the 'mainloop' method of the root Tk
window created by Tk(), so it does work as-is.


Didn't know that, thank you!
--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-06 Thread MRAB

On 2020-12-06 08:11, Sibylle Koczian wrote:

Am 05.12.2020 um 19:56 schrieb Paulo da Silva:

Hi!

Why this example does not work?

--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)

...

mainloop()
-



Shouldn't that be

root.mainloop()

?

The function 'mainloop' calls the 'mainloop' method of the root Tk 
window created by Tk(), so it does work as-is.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-06 Thread Sibylle Koczian

Am 05.12.2020 um 19:56 schrieb Paulo da Silva:

Hi!

Why this example does not work?

--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)

...

mainloop()
-



Shouldn't that be

root.mainloop()

?


--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-05 Thread Paulo da Silva
Às 20:20 de 05/12/20, MRAB escreveu:
> On 2020-12-05 18:56, Paulo da Silva wrote:
>> Hi!
>>
>> Why this example does not work?
>>
> There are a few bits of configuration missing:
> 
>> --
>> from tkinter import *
>>
>> root=Tk()
>> root.geometry("400x200")
> 
> Add:
> 
> root.grid_rowconfigure(0, weight=1)
> root.grid_columnconfigure(0, weight=1)
> root.grid_columnconfigure(1, weight=0)
> 
>> S=Scrollbar(root)
>> T=Text(root)
>> T.grid(row=0,column=0)
>> S.grid(row=0,column=1)
> 
> Change to:
> 
> T.grid(row=0, column=0, sticky=NSEW)
> S.grid(row=0, column=1, sticky=NS)
> 
>> S.config(command=T.yview)
>> T.config(yscrollcommand=S.set)
>> txt="""This is a very big text
>> -

Ok, thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter - a grid problem

2020-12-05 Thread MRAB

On 2020-12-05 18:56, Paulo da Silva wrote:

Hi!

Why this example does not work?


There are a few bits of configuration missing:


--
from tkinter import *

root=Tk()
root.geometry("400x200")


Add:

root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
root.grid_columnconfigure(1, weight=0)


S=Scrollbar(root)
T=Text(root)
T.grid(row=0,column=0)
S.grid(row=0,column=1)


Change to:

T.grid(row=0, column=0, sticky=NSEW)
S.grid(row=0, column=1, sticky=NS)


S.config(command=T.yview)
T.config(yscrollcommand=S.set)
txt="""This is a very big text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Last line
"""
T.insert(END,txt)
mainloop()
-


[snip]
--
https://mail.python.org/mailman/listinfo/python-list


Learning tkinter - a grid problem

2020-12-05 Thread Paulo da Silva
Hi!

Why this example does not work?

--
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)
T.grid(row=0,column=0)
S.grid(row=0,column=1)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
txt="""This is a very big text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Last line
"""
T.insert(END,txt)
mainloop()
-

I would like it to work more or less like this

-
from tkinter import *

root=Tk()
root.geometry("400x200")
S=Scrollbar(root)
T=Text(root)
S.pack(side=RIGHT,fill=Y)
T.pack(side=LEFT,fill=Y)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
txt="""This is a very big text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Last line
"""
T.insert(END,txt)
mainloop()
-

Thanks for any help
Paulo

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning Tkinter

2008-04-17 Thread Eric Brunel
On Wed, 16 Apr 2008 14:46:13 +0200, Doran, Harold [EMAIL PROTECTED] wrote:
[snip]
 Second, I am trying to work through a couple of the examples and make
 some small tweaks as I go to see how new things can work. In the first
 case, I have copied the code in the book to see how the menu works and
 are created as in the example menu.py below. I see how menus are created
 and how the command option is used to call the function callback.

 # menu.py
 from Tkinter import *

 def callback():
 print called the callback!

 root = Tk()

 # create a menu
 menu = Menu(root)
 root.config(menu=menu)

 filemenu = Menu(menu)
 menu.add_cascade(label=File, menu=filemenu)
 filemenu.add_command(label=New, command=harold)
 filemenu.add_command(label=Open..., command=callback)
 filemenu.add_separator()
 filemenu.add_command(label=Exit, command=callback)

 helpmenu = Menu(menu)
 menu.add_cascade(label=Help, menu=helpmenu)
 helpmenu.add_command(label=About..., command=callback)

 mainloop()

 However, I now want to incorporate a basic python program with a
 command. Say I have a simple program called test.py

 # test.py
 filename = raw_input(Please enter the file you want to open: )
 new_file = raw_input(Save the output file as: )

 f = open(new_file, 'w')
 new = open(filename, 'r')

 for line in new:
   x = line.split('\t')
   print  f, x[0],':', x[1]
 f.close()

 To make this example complete assume I have a text file like this

 # data.txt
 1 one
 2 two
 3 three
 4 four

 So, the user currently just follows directions on the screen, enters the
 file names, and I get what I want. I'd like to try experimenting with
 gui programming to see if the python programs I have written can be made
 even more user friendly. I currently use py2exe to create executables so
 that others in my organization can use these programs.
 In that spirit, say I want to have a menu option that allows the user to
 search their computer for this file, execute the python code and then
 save the result as a user-defined filename. So, I guess my questions are
 how do I associate the portion of code in menu.py
 filemenu.add_command(label=Open..., command=callback) with an
 operation that gives the user the ability to search the drives on their
 machine and then once they do let python execute the code in test.py?

The way it's written, you'll have a hard time doing it... Since test.py  
already includes a user interface via the raw_input calls, executing  
test.py will always ask the user for the file names, and there's no simple  
way to pass them otherwise as the module is written.

Considering how you asked the question, I'll assume you don't know Python  
very much; my apologies in advance if it's not the case...

So, what I would do is rewrite the test.py script as follows:

--- test.py ---
def convert_file(filename, new_file):
   f = open(new_file, 'w')
   new = open(filename, 'r')

   for line in new:
 x = line.split('\t')
 print  f, x[0],':', x[1]
   f.close()

if __name__ == '__main__':
   filename = raw_input(Please enter the file you want to open: )
   new_file = raw_input(Save the output file as: )
   convert_file(filename, new_file)
---

This is basically the same as yours in another order, and defining a  
function that actually does the 'functional' part without asking the user  
anything. The last block - starting with this weird 'if __name__ ==  
'__main__':' - ensures the script will work as you expect when you run it  
alone on the command line (with 'python test.py'). This is the meaning of  
the test on __name__: this magical variable is set to the string  
'__main__' if and only if the current script is the top-most one, i.e the  
one you ran python on. So basically, the script now defines a function,  
then asks for the function parameters and calls it _only if run as the  
main script_. Try it; it should have the same behaviour as the script  
you've written.

But the test on __name__ also allows to *import* this script as a module  
in another script without nasty side effects. This is done via the  
statement:

import test

in the other script. If test.py is written as above, this will execute the  
function definition, but not the body of the 'if', since test.py is no  
more run from the command line, but used in an import. If you didn't have  
this test, the module would have been *executed* by the import, and is  
would have asked the file names immediatly.

Once you've done the import, you can then use the function it defines by  
calling test.convert_file. So now, in your GUI part, you can now write  
something like:


--- menu.py --
## NEW! the next line gets the 'convert_file' function
import test
 from Tkinter import *
## NEW! the next line gets the functions used to get file names via a  
Tkinter GUI
 from tkFileDialog import askopenfilename, asksaveasfilename

## NEW! the 

Learning Tkinter

2008-04-16 Thread Doran, Harold
I am currently reading An Intro to Tkinter (1999) by F. Lundh. This doc
was published in 1999 and I wonder if there is a more recent version.
I've googled a bit and this version is the one I keep finding. I like
how this document is organized and also how it provides the code with
visuals of what should appear on the screen. If there are other docs I
should read, please let me know.

Second, I am trying to work through a couple of the examples and make
some small tweaks as I go to see how new things can work. In the first
case, I have copied the code in the book to see how the menu works and
are created as in the example menu.py below. I see how menus are created
and how the command option is used to call the function callback.

# menu.py
from Tkinter import *

def callback():
print called the callback!

root = Tk()

# create a menu
menu = Menu(root)
root.config(menu=menu)

filemenu = Menu(menu)
menu.add_cascade(label=File, menu=filemenu)
filemenu.add_command(label=New, command=harold)
filemenu.add_command(label=Open..., command=callback)
filemenu.add_separator()
filemenu.add_command(label=Exit, command=callback)

helpmenu = Menu(menu)
menu.add_cascade(label=Help, menu=helpmenu)
helpmenu.add_command(label=About..., command=callback)

mainloop()

However, I now want to incorporate a basic python program with a
command. Say I have a simple program called test.py 

# test.py
filename = raw_input(Please enter the file you want to open: )
new_file = raw_input(Save the output file as: )

f = open(new_file, 'w')
new = open(filename, 'r')

for line in new:
x = line.split('\t')
print  f, x[0],':', x[1] 
f.close()

To make this example complete assume I have a text file like this

# data.txt
1   one
2   two
3   three
4   four

So, the user currently just follows directions on the screen, enters the
file names, and I get what I want. I'd like to try experimenting with
gui programming to see if the python programs I have written can be made
even more user friendly. I currently use py2exe to create executables so
that others in my organization can use these programs. 
 
In that spirit, say I want to have a menu option that allows the user to
search their computer for this file, execute the python code and then
save the result as a user-defined filename. So, I guess my questions are
how do I associate the portion of code in menu.py
filemenu.add_command(label=Open..., command=callback) with an
operation that gives the user the ability to search the drives on their
machine and then once they do let python execute the code in test.py?

Many thanks,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learning Tkinter

2008-04-16 Thread srf99
You might want to look at these:

Thinking in Tkinter
http://www.ferg.org/thinking_in_tkinter/index.html

Easygui
http://www.ferg.org/easygui/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learning Tkinter

2008-04-16 Thread Mike Driscoll
On Apr 16, 7:46 am, Doran, Harold [EMAIL PROTECTED] wrote:
 I am currently reading An Intro to Tkinter (1999) by F. Lundh. This doc
 was published in 1999 and I wonder if there is a more recent version.
 I've googled a bit and this version is the one I keep finding. I like
 how this document is organized and also how it provides the code with
 visuals of what should appear on the screen. If there are other docs I
 should read, please let me know.


There's some good Tkinter coverage in Lutz's tome, Programming Python
3rd Ed. and it also shows how to do a search for a file across your
file system, iirc.



 Second, I am trying to work through a couple of the examples and make
 some small tweaks as I go to see how new things can work. In the first
 case, I have copied the code in the book to see how the menu works and
 are created as in the example menu.py below. I see how menus are created
 and how the command option is used to call the function callback.

 # menu.py
 from Tkinter import *

 def callback():
 print called the callback!

 root = Tk()

 # create a menu
 menu = Menu(root)
 root.config(menu=menu)

 filemenu = Menu(menu)
 menu.add_cascade(label=File, menu=filemenu)
 filemenu.add_command(label=New, command=harold)
 filemenu.add_command(label=Open..., command=callback)
 filemenu.add_separator()
 filemenu.add_command(label=Exit, command=callback)

 helpmenu = Menu(menu)
 menu.add_cascade(label=Help, menu=helpmenu)
 helpmenu.add_command(label=About..., command=callback)

 mainloop()

 However, I now want to incorporate a basic python program with a
 command. Say I have a simple program called test.py

 # test.py
 filename = raw_input(Please enter the file you want to open: )
 new_file = raw_input(Save the output file as: )

 f = open(new_file, 'w')
 new = open(filename, 'r')

 for line in new:
 x = line.split('\t')
 print  f, x[0],':', x[1]
 f.close()

 To make this example complete assume I have a text file like this

 # data.txt
 1   one
 2   two
 3   three
 4   four

 So, the user currently just follows directions on the screen, enters the
 file names, and I get what I want. I'd like to try experimenting with
 gui programming to see if the python programs I have written can be made
 even more user friendly. I currently use py2exe to create executables so
 that others in my organization can use these programs.

 In that spirit, say I want to have a menu option that allows the user to
 search their computer for this file, execute the python code and then
 save the result as a user-defined filename. So, I guess my questions are
 how do I associate the portion of code in menu.py
 filemenu.add_command(label=Open..., command=callback) with an
 operation that gives the user the ability to search the drives on their
 machine and then once they do let python execute the code in test.py?

 Many thanks,

It sounds like you want to run code from within your own program. This
would require embedding a Python interpreter, which is quite possible,
although I do not know how to do it. I would suggest that you just use
a Tkinter-created frame/window that allows the user to enter the
information into text controls rather than a command line type
interface. You could even use a Browse button and let the user
search for the file using a file dialog. Check out the sample code for
such a beast in the recipe linked below:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438123

If you do want to go the embedding route, you'll want to read the
following information linked below:

http://docs.python.org/api/embedding.html
http://www.python.org/doc/ext/embedding.html
http://www.ragestorm.net/tutorial?id=21
http://www.codeproject.com/KB/cpp/embedpython_1.aspx

Hope that gets you going.

Mike
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-07 Thread Dick Moores
At 10:36 AM 4/6/2007, Russell E. Owen wrote:
In article [EMAIL PROTECTED],
  Kevin Walzer [EMAIL PROTECTED] wrote:

  James Stroud wrote:
  This begs the
   question, is anyone truly an expert in Tkinter?
 
  Frederick Lundh is, if anyone is.
 
  http://www.pythonware.com/library/tkinter/introduction/index.htm (outdated)
  http://effbot.org/tkinterbook/ (new but incomplete)

I agree that this is an excellent resource.

I find Welch's book and the on-line tcl/tk help very helpful for Tkinter
programming--especially some of the more obscure details. But to use
either of these resources comfortably you must learn the basics of
Tkinter first (including understanding the simple mapping between
Tkinter and Tcl/Tk).

Where can I get this mapping spelled out?

For learning the basics of Tkinter I suggest the links that Kevin listed
above and/or Alex Martelli's Python in a Nutshell (an excellent
reference in any case).

Although owning the 2nd ed. of Python is a Nutshell, I hadn't 
thought of looking into it for Tkinker. There's a whole chapter, 
Tkinter GUIs (46 pages!).

  Grayson's book is another reasonable alternative
(and includes enough reference material to keep you from having to refer
to the tcl/tk documentation very often).

One web tutorial that looks good to me is Thinking in Tkinter, by 
Stephen Ferg (http://www.ferg.org/thinking_in_tkinter/index.html).

My thanks to all who responded.

Dick Moores


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-07 Thread James Stroud
Dick Moores wrote:
 At 10:36 AM 4/6/2007, Russell E. Owen wrote:
 I find Welch's book and the on-line tcl/tk help very helpful for Tkinter
 programming--especially some of the more obscure details. But to use
 either of these resources comfortably you must learn the basics of
 Tkinter first (including understanding the simple mapping between
 Tkinter and Tcl/Tk).
 
 Where can I get this mapping spelled out?

Grayson Appendix A. $25 pdf--well worth it in your time.

James
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-07 Thread Dick Moores
At 03:43 AM 4/7/2007, James Stroud wrote:
Dick Moores wrote:
  At 10:36 AM 4/6/2007, Russell E. Owen wrote:
  I find Welch's book and the on-line tcl/tk help very helpful for Tkinter
  programming--especially some of the more obscure details. But to use
  either of these resources comfortably you must learn the basics of
  Tkinter first (including understanding the simple mapping between
  Tkinter and Tcl/Tk).
 
  Where can I get this mapping spelled out?

Grayson Appendix A. $25 pdf--well worth it in your time.

Terrific! Thank you.

Dick

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-06 Thread Russell E. Owen
In article [EMAIL PROTECTED],
 Kevin Walzer [EMAIL PROTECTED] wrote:

 James Stroud wrote:
 This begs the 
  question, is anyone truly an expert in Tkinter?
 
 Frederick Lundh is, if anyone is.
 
 http://www.pythonware.com/library/tkinter/introduction/index.htm (outdated)
 http://effbot.org/tkinterbook/ (new but incomplete)

I agree that this is an excellent resource.

I find Welch's book and the on-line tcl/tk help very helpful for Tkinter 
programming--especially some of the more obscure details. But to use 
either of these resources comfortably you must learn the basics of 
Tkinter first (including understanding the simple mapping between 
Tkinter and Tcl/Tk).

For learning the basics of Tkinter I suggest the links that Kevin listed 
above and/or Alex Martelli's Python in a Nutshell (an excellent 
reference in any case). Grayson's book is another reasonable alternative 
(and includes enough reference material to keep you from having to refer 
to the tcl/tk documentation very often).

-- Russell
-- 
http://mail.python.org/mailman/listinfo/python-list


Welch essential for learning Tkinter well?

2007-04-05 Thread Dick Moores
In a couple of places recently I've seen Brent Welch's _Practical 
Programming in Tcl  Tk_ (http://tinyurl.com/ynlk8b) recommended 
for learning Tkinter well.

So a couple of questions:

1) Is it really good for learning Tkinter, even though it doesn't 
mention Tkinter at all (in the 4th edition at least)?

2) If it is good for learning Tkinter, can I get by with a cheaper, 
used copy of the 3rd edition?

Thanks,

Dick Moores

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-05 Thread James Stroud
Dick Moores wrote:
 In a couple of places recently I've seen Brent Welch's _Practical 
 Programming in Tcl  Tk_ (http://tinyurl.com/ynlk8b) recommended for 
 learning Tkinter well.
 
 So a couple of questions:
 
 1) Is it really good for learning Tkinter, even though it doesn't 
 mention Tkinter at all (in the 4th edition at least)?
 
 2) If it is good for learning Tkinter, can I get by with a cheaper, used 
 copy of the 3rd edition?
 
 Thanks,
 
 Dick Moores
 

Probably better is to get Grayson (google Grayson Tkinter). It covers 
Tkinter -- Tcl/Tk mapping to sufficient extent for Tkinter 
proficiency. I have found the online Tcl/Tk documentation to fill in the 
gaps.

Tkinter seems to me to have been created largely automatically and so 
has much of the documentation that maps it to Tcl/Tk. This begs the 
question, is anyone truly an expert in Tkinter?

James
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-05 Thread Kevin Walzer
James Stroud wrote:
This begs the 
 question, is anyone truly an expert in Tkinter?

Frederick Lundh is, if anyone is.

http://www.pythonware.com/library/tkinter/introduction/index.htm (outdated)
http://effbot.org/tkinterbook/ (new but incomplete)

Coming to Python from a Tcl/Tk background, I find Tkinter to be pretty 
compatible with what I know about Tk: usually it's just a matter of 
figuring out how to translate the code. Having a Tk background from Tcl 
is also helpful in using some of the more advanced Tcl/Tk stuff that has 
been wrapped in Python, but isn't much documented or widely used, such 
as BWidgets.

 From that standpoint, the Welch book is a useful resource, though 
probably not essential.

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Welch essential for learning Tkinter well?

2007-04-05 Thread Paul Rubin
Dick Moores [EMAIL PROTECTED] writes:
 In a couple of places recently I've seen Brent Welch's _Practical
 Programming in Tcl  Tk_ (http://tinyurl.com/ynlk8b) recommended for
 learning Tkinter well.

I'm skeptical of the value of learning Tkinter really well.  No matter
how thoroughly you learn it, your GUI's are going to look crude and
have a limited widget set.  For lots of applications, a basic GUI
which implements the needed functions straightforwardly is fine and
Tkinter is good for that kind of thing.  I've used it that way based
on the online tutorials and it's been good enough for my purposes.
But if I needed something fancier I'd probably go to a more advanced
toolkit rather than trying to push the limits of tkinter.

I mainly use

   http://infohost.nmt.edu/tcc/help/pubs/tkinter/

as tkinter docs and it's pretty good.
-- 
http://mail.python.org/mailman/listinfo/python-list