jaba | 1 Jul 2006 05:31

Canvas pixels

is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas?

Thank You
Jeff Epler | 1 Jul 2006 15:19
Favicon

Re: Canvas pixels

On Fri, Jun 30, 2006 at 11:31:24PM -0400, jaba <at> findyourcore.com wrote:
> is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas?

No, tk doesn't provide a way to do this.

Jeff
Olivier Feys | 3 Jul 2006 16:24
Picon

grid sticky problem

I'm trying to add frames in a master frame with the grid manager, and it 
seems that the option 'sticky' doesn't work as it should
When I change the size of the master frame, the subframes don't want to 
be resized like expand =1 , fill = 'both' for pack layout manager
Thanks for help

import Tkinter as tk
root = tk.Tk()
frames= []
rw = 0

col=0
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='nswe')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
rw+=1
col=0
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
rw+=1
(Continue reading)

Cameron Laird | 3 Jul 2006 17:22

Re: Canvas pixels

On Sat, Jul 01, 2006 at 08:19:29AM -0500, Jeff Epler wrote:
			.
			.
			.
> > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas?
> 
> No, tk doesn't provide a way to do this.
			.
			.
			.
True.

This annoyed me so much, though, that I researched it a tiny
bit more.  The Img extension, as it happens, can snapshot a
canvas into a photo, and Tkinter itself can report on the
pixel values in a photo image.

That's as good as it gets, apparently.  What I don't know is
whether Tkinter supports Img at all; I must confess that I'm
only aware of its availability for Tcl/Tk.
Jeff Epler | 3 Jul 2006 22:04
Favicon

Re: grid sticky problem

You need to give some rows or columns nonzero weight.

master.grid_rowconfigure(rownum, weight=1)
master.grid.columconfigure(colnum, weight=1)

Jeff
Michael Lange | 3 Jul 2006 23:37
Picon

Re: Canvas pixels

On Mon, 3 Jul 2006 15:22:13 +0000
Cameron Laird <Cameron <at> phaseit.net> wrote:

> On Sat, Jul 01, 2006 at 08:19:29AM -0500, Jeff Epler wrote:
> 			.
> 			.
> 			.
> > > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas?
> > 
> > No, tk doesn't provide a way to do this.
> 			.
> 			.
> 			.
> True.
> 
> This annoyed me so much, though, that I researched it a tiny
> bit more.  The Img extension, as it happens, can snapshot a
> canvas into a photo, and Tkinter itself can report on the
> pixel values in a photo image.
> 
> That's as good as it gets, apparently.  What I don't know is
> whether Tkinter supports Img at all; I must confess that I'm
> only aware of its availability for Tcl/Tk.

Do you mean the tkImg library from <http://sourceforge.net/projects/tkimg/> ?
If so, I have used it successfully by just adding a line

    root.tk.call('package', 'require', 'Img')

(where root of course is my Tk() window).
(Continue reading)

jkuo | 4 Jul 2006 05:12
Picon
Favicon

simple script -Tkinter question.

Hi everyone,
Here is my simple Tkinter script:
 
## start of entry.py
from Tkinter import *
root=Tk()
e1=Entry(root, width=16)
e1.pack()
e2=Entry(root, width=16)
e2.pack()
mainloop()
## end
 
First, it works on win2k. When I run it as 'python entry.py' on linux,
both 'e1' and 'e2' appear perfectly except I cannot enter any
character in 'e1' entry, but 'e2' entry is ok.
 
Second, when I run it in python interactive shell LINE BY LINE, then
'e1' and 'e2' entry both can accept user input, no problem! But when I
copy and paste it into interactive shell, then the first situation
happens again.
 
So..., has anyone ever run into this problem like me? and how do you
fix it? I use python2.3.4 now.
Thank you!
 
jkuo

___________________________________________________
最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打!
http://messenger.yahoo.com.tw/

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
mkieverpy | 4 Jul 2006 09:48
Picon

Re: simple script -Tkinter question.

Hi jkuo!

>Hi everyone,
>Here is my simple Tkinter script:

>## start of entry.py
>from Tkinter import *
>root=Tk()
>e1=Entry(root, width=16)
>e1.pack()
>e2=Entry(root, width=16)
>e2.pack()
>mainloop()
>## end

You should call 'root.mainloop()'!
Just mainloop() is the mainloop of Tcl, not Tk.
I don't know what the effects of this might be.
On Linux everything seems to work, nonetheless.

Hope this helps,

Matthias Kievernagel
mkiever/at/web/dot/de
software development
jkuo | 4 Jul 2006 11:54
Picon
Favicon

Fwd: Re: simple script -Tkinter question.



注意:轉寄信件已夾帶

___________________________________________________
最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打!
http://messenger.yahoo.com.tw/

Picon Favicon
From: jkuo <jkuo22 <at> yahoo.com.tw>
Subject: Re: [Tkinter-discuss] simple script -Tkinter question.
Date: 2006-07-04 09:52:40 GMT

Hello mkieverpy!
 
I've also tried to call 'root.mainloop()', but it appeared the same.
 
I've once suspected that it might be the os, x window issue..., but as
 
I mentioned: it works by running the script line by line in python interactive shell,
 
It just doesn't work no matter I run it as 'python entry.py' or copy and paste into
 
python's interactive shell, very weired.
 
BR.
mkieverpy <at> tlink.de 說:
Hi jkuo!

>Hi everyone,
>Here is my simple Tkinter script:

>## start of entry.py
>from Tkinter import *
>root=Tk()
>e1=Entry(root, width=16)
>e1.pack()
>e2=Entry(root, width=16)
>e2.pack()
>mainloop()
>## end

You should call 'root.mainloop()'!
Just mainloop() is the mainloop of Tcl, not Tk.
I don't know what the effects of this might be.
On Linux everything seems to work, nonetheless.

Hope this helps,

Matthias Kievernagel
mkiever/at/web/dot/de
software development

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

___________________________________________________
最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打!
http://messenger.yahoo.com.tw/

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Michael Lange | 4 Jul 2006 11:59
Picon

Re: simple script -Tkinter question.

On Tue, 4 Jul 2006 09:48:44 +0200
mkieverpy <at> tlink.de wrote:

> Hi jkuo!
> 
> >Hi everyone,
> >Here is my simple Tkinter script:
> 
> >## start of entry.py
> >from Tkinter import *
> >root=Tk()
> >e1=Entry(root, width=16)
> >e1.pack()
> >e2=Entry(root, width=16)
> >e2.pack()
> >mainloop()
> >## end
> 
> You should call 'root.mainloop()'!
> Just mainloop() is the mainloop of Tcl, not Tk.
> I don't know what the effects of this might be.
> On Linux everything seems to work, nonetheless.
> 

Really? From Tkinter.py it looks to me like it should be equivalent:

def mainloop(n=0):
    """Run the main loop of Tcl."""
    _default_root.tk.mainloop(n)

(...snip...)

class Tk(Misc, Wm):
    """Toplevel widget of Tk which represents mostly the main window
    of an appliation. It has an associated Tcl interpreter."""
    _w = '.'
    def __init__(self, screenName=None, baseName=None, className='Tk'):
        global _default_root
        (...snip...)
        if _support_default_root and not _default_root:
            _default_root = self

so _default_root is the  Tk() instance. Unfortunately this does not explain what is going wrong in the example.

Michael

Gmane