[Tkinter-discuss] Off Topic : Tkinter in everyday life

2010-12-17 Thread craf
Hi everyone.! I apologize in advance, since English is not my native language and some things can not understand and misinterpret. Very recently I found Python and Tkinter. Needless to say, I find a tool Tkinter extremely cool and functional, which I am discovering little by little every day. On

Re: [Tkinter-discuss] [Fwd: Re: lambda function to simplify]

2010-12-17 Thread Michael Lange
Hi, Thus spoketh craf unto us on Fri, 17 Dec 2010 19:15:39 -0300: (...) > My guess is that if the instruction... > > self.root.protocol('WM_DELETE_WINDOW', lambda:((lambda > e,widget=self:greeting(widget))(self.root))) > > can be shortened to occupy the same line? > > It's for a better unde

[Tkinter-discuss] [Fwd: Re: Upload control parameter sashpos to load the program.]

2010-12-17 Thread craf
- Mensaje reenviado > De: Michael Lange > Para: tkinter-discuss@python.org > Asunto: Re: [Tkinter-discuss] Upload control parameter sashpos to load > the program. > Fecha: Sat, 18 Dec 2010 02:41:57 +0100 > > Hi, > > Thus spoketh craf > unto us on Fri, 17 Dec 2010 19:49:58 -030

Re: [Tkinter-discuss] Upload control parameter sashpos to load the program.

2010-12-17 Thread Michael Lange
Hi, Thus spoketh craf unto us on Fri, 17 Dec 2010 19:49:58 -0300: > Hi. > > I'm trying that opening the window, the position of the handle, is > located where you want, using the method "sashpos", in the following > code (...) > -

[Tkinter-discuss] Upload control parameter sashpos to load the program.

2010-12-17 Thread craf
Hi. I'm trying that opening the window, the position of the handle, is located where you want, using the method "sashpos", in the following code from tkinter import * from tkinter import ttk class App: def __init__(se

[Tkinter-discuss] [Fwd: Re: lambda function to simplify]

2010-12-17 Thread craf
- Mensaje reenviado > De: Michael Lange > Para: tkinter-discuss@python.org > Asunto: Re: [Tkinter-discuss] lambda function to simplify > Fecha: Fri, 17 Dec 2010 22:30:44 +0100 > > Hi, > > Thus spoketh craf > unto us on Fri, 17 Dec 2010 15:16:22 -0300: > > (...) > > I have acc

Re: [Tkinter-discuss] lambda function to simplify

2010-12-17 Thread Michael Lange
Hi, Thus spoketh craf unto us on Fri, 17 Dec 2010 15:16:22 -0300: (...) > I have access to the function (greeting) from the button and the window > close button. > > It works fine, but wanted to know whether the use of lambda (lambda), > can be expressed in another way more elegant and less co

Re: [Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

2010-12-17 Thread python
Michael, > However I agree, it's better to use create_window() to avoid pitfalls like > this. 1. So the proper way to use Canvases as containers for traditional widgets is to manually handle layout and place all widgets via the create_window() method. 2. The only reason to use a Canvas as a con

Re: [Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

2010-12-17 Thread python
Hi Mick, > I have never heard of packing widgets within a canvas. Here's the link that gave me that impression: http://stackoverflow.com/questions/4080413/python-tkinter-place-a-widget-in-a-canvas-widget You can easily add widgets to a canvas just like you do any other container, using pack or

Re: [Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

2010-12-17 Thread Michael Lange
Hi, Thus spoketh "Michael O'Donnell" unto us on Fri, 17 Dec 2010 19:14:27 +0100: (...) > > The Label widget in fact REPLACES the canvas in the display > rather than being packed within it. I don't know why (try commenting out > the d.pack() line) and see the difference.) > I changed your exampl

Re: [Tkinter-discuss] When to use .update() vs. update_idletasks()?

2010-12-17 Thread python
Michael, > BTW, for those who want to read more about update() vs. update_idletasks(), > there are two pages on the tcl'ers wiki that discuss the potential problems > with the update() method in more detail: > > http://wiki.tcl.tk/1252 > http://wiki.tcl.tk/1255 Excellent resources. Thank you,

Re: [Tkinter-discuss] When to use .update() vs. update_idletasks()?

2010-12-17 Thread Michael Lange
Thus spoketh pyt...@bdurham.com unto us on Fri, 17 Dec 2010 12:56:22 -0500: > > As a rule of thumb I'd say: *never* use update() unless you really > > need it. If update_idletasks() does the job, it is to be preferred. > BTW, for those who want to read more about update() vs. update_idletasks(

[Tkinter-discuss] lambda function to simplify

2010-12-17 Thread craf
Hi. According to this code -- import Tkinter class App: def __init__(self, master): self.root = master self.b1 = Tkinter.Button(master) self.b1.pack() self.b1.bind('', lambda e,widget=self:gr

Re: [Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

2010-12-17 Thread Michael O'Donnell
Hi Malcom, I have never heard of packing widgets within a canvas. Just use create_window, so there is no automatic placement, you need to handle all placement. Note with the following, packing a label within a canvas: from Tkinter import * root = Tk() c=Canvas(root, bg="red", width=400, height=4

Re: [Tkinter-discuss] When to use .update() vs. update_idletasks()?

2010-12-17 Thread python
> As a rule of thumb I'd say: *never* use update() unless you really need it. > If update_idletasks() does the job, it is to be preferred. Thanks Michael, that's a great tip. Malcolm ___ Tkinter-discuss mailing list Tkinter-discuss@python.org http://ma

[Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

2010-12-17 Thread python
This question is related to using Canvases and Frames as containers and does not consider the drawing capabilities of the Canvas widget. Canvas and Frames are both containers. My understanding is that both of these containers provide identical layout behaviors via their pack, grid, and place metho

Re: [Tkinter-discuss] When to use .update() vs. update_idletasks()?

2010-12-17 Thread Michael Lange
Thus spoketh pyt...@bdurham.com unto us on Fri, 17 Dec 2010 12:27:41 -0500: > Looking for some advice on when to use .update() vs. > update_idletasks(). Are there use cases that favor the use of one > of these techniques vs. the other? Are there situations where one > of these techniques should a

[Tkinter-discuss] Stipple use cases and/or examples?

2010-12-17 Thread python
I've seen the term "stipple" mentioned in recent posts. The Tkinter documentation is woefully short on details here. I've googled for examples and found very few. For those with the same question as me, here's one example. http://infohost.nmt.edu/tcc/help/pubs/tkinter/std-attrs.html My question is

Re: [Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread Michael Lange
Thus spoketh pyt...@bdurham.com unto us on Fri, 17 Dec 2010 12:04:18 -0500: > Michael, > > Your code works wonderfully - thank you very much!! > > One question: Why did you add your inner frame to the canvas as a window > via c.create_window() vs. just packing the frame? > To be honest, for n

[Tkinter-discuss] When to use .update() vs. update_idletasks()?

2010-12-17 Thread python
Looking for some advice on when to use .update() vs. update_idletasks(). Are there use cases that favor the use of one of these techniques vs. the other? Are there situations where one of these techniques should always or never be used? Thank you, Malcolm __

Re: [Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread python
Michael, Your code works wonderfully - thank you very much!! One question: Why did you add your inner frame to the canvas as a window via c.create_window() vs. just packing the frame? I tried the frame packing technique per the following code change (replacing c.createwindow with pack): f = Fra

Re: [Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread Michael Lange
Thus spoketh pyt...@bdurham.com unto us on Fri, 17 Dec 2010 09:00:08 -0500: > I understand that Tkinter frames do not have a property that > allows their border color to be customized. > > Here are some high level ideas I have on how to create a colored > border effect - any suggestions on best

Re: [Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread python
> On 2, definitely. Rather than using fill, you could set the outline color, style, and width (e.g. dash/stipple): [1]> http://effbot.org/tkinterbook/canvas.htm Thanks Wayne, Malcolm References 1. http://effbot.org/tkinterbook/canvas.htm ___ Tkinter-d

Re: [Tkinter-discuss] experimental tk program in python3

2010-12-17 Thread python
Michael, Ah, I see! The trick seems to be: - don't set a frame's border width or relief properties (or reset them to 0 and 'flat') - set highlightcolor= - set highlightbackground= - set highlightthickness= I think that also answers the question I just posted regarding how to create the appearanc

[Tkinter-discuss] as close windows by separate modules

2010-12-17 Thread Firat Ozgul
Check the following out. code.py from tkinter import messagebox from tkinter import * from tkinter import ttk class Option: def quit(master): if messagebox.askyesno(message='Close window'): master.quit() main.py --- from tkinter import * from tkin

Re: [Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread Wayne Werner
On Fri, Dec 17, 2010 at 8:00 AM, wrote: > I understand that Tkinter frames do not have a property that allows their > border color to be customized. > > Here are some high level ideas I have on how to create a colored border > effect - any suggestions on best practice appreciated. > > 2. Use a

Re: [Tkinter-discuss] experimental tk program in python3

2010-12-17 Thread Michael Lange
Hi, Thus spoketh pyt...@bdurham.com unto us on Fri, 17 Dec 2010 08:41:45 -0500: > Hi Michael, > > > For widgets that don't accept keyboard focus you can use the > > highlightbackground option to create a colored border (although you > > cannot add a "3D"-relief this way) ... > > I took your e

[Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

2010-12-17 Thread python
I understand that Tkinter frames do not have a property that allows their border color to be customized. Here are some high level ideas I have on how to create a colored border effect - any suggestions on best practice appreciated. 1. Turn off the frame's border. Enclose the frame in a parent fra

Re: [Tkinter-discuss] experimental tk program in python3

2010-12-17 Thread python
Hi Michael, > For widgets that don't accept keyboard focus you can use the > highlightbackground option to create a colored border (although you cannot > add a "3D"-relief this way) ... I took your example and added another frame and widgets that gain focus. Your highlightbackground suggestion

Re: [Tkinter-discuss] experimental tk program in python3

2010-12-17 Thread Michael Lange
Hi, Thus spoketh pyt...@bdurham.com unto us on Thu, 16 Dec 2010 18:07:27 -0500: > Dave, > > Works in Python 2.7 by changing import statements to: > > from Tkinter import * > import ttk > > Is there a way to change a frame's border color? (I think this is a > Tkinter limitation, but I'd love t

[Tkinter-discuss] [Fwd: Re: Calling functions outside the class]

2010-12-17 Thread craf
- Mensaje reenviado > De: Michael O'Donnell > Para: craf > Cc: Python Tkinter Ingles > Asunto: Re: [Tkinter-discuss] Calling functions outside the class > Fecha: Fri, 17 Dec 2010 09:03:28 +0100 > > Hi Cristian, > > The problem is, self is only defined within the class defini

Re: [Tkinter-discuss] Calling functions outside the class

2010-12-17 Thread Michael O'Donnell
Hi Cristian, The problem is, self is only defined within the class definition. Basically, the function are not part of the class, just called by the class. We use a lambda to get the class passed to the function. So, to correct your code: from Tkinter import * class MyApp: def __init__(self