From jackie3 at cox.net Mon Jun 6 18:44:05 2011 From: jackie3 at cox.net (Jack Eisenbach) Date: Mon, 6 Jun 2011 09:44:05 -0700 Subject: [Tkinter-discuss] Version conflict for Tcl running 2.7.1 on Windows Message-ID: Hi, I installed Python 2.7.1 on my Windows 7 32-bit version. I get the following error when I run my Tkinter application. I can run the same application on both Python 2.6.5 and 2.6.6 without the problem below. c:\ISS\ledmatrix>led-display.py Traceback (most recent call last): File "ledmatrix.py", line 2263, in LEDMatrix() File "ledmatrix.py", line 1427, in LEDMatrix root = Tk() File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: Can't find a usable init.tcl in the following directories: {C:\Python27\tcl\tcl8.5} C:/Python26/lib/tcl8.5 C:/lib/tcl8.5 C:/lib/tcl8.5 C:/library C:/library C:/tcl8.5.8/library C:/tcl8.5.8/library C:/Python27/tcl/tcl8.5/init.tcl: version conflict for package "Tcl": have 8.5.8, need exactly 8.5.2 version conflict for package "Tcl": have 8.5.8, need exactly 8.5.2 while executing "package require -exact Tcl 8.5.2" (file "C:/Python27/tcl/tcl8.5/init.tcl" line 20) invoked from within "source C:/Python27/tcl/tcl8.5/init.tcl" ("uplevel" body line 1) invoked from within "uplevel #0 [list source $tclfile]" This probably means that Tcl wasn't installed properly. Can this be corrected in 2.7.1? Thanks in advance, Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: From magni at inrim.it Tue Jun 7 15:03:09 2011 From: magni at inrim.it (alexxxm) Date: Tue, 7 Jun 2011 06:03:09 -0700 (PDT) Subject: [Tkinter-discuss] newbie request for help Message-ID: <31791699.post@talk.nabble.com> Hi everybody, I need some help to understand if tkinter is in fact the right tool to use for me. I intend to write a very bare-bone wiki in python. It should be able to: 1) open a text file 2) display the text file, with links in the form {{image.jpg}} replaced by the image, and [[linkname|linkfile.txt]] replaced by linkname 3) when clicking on linkname, save the current text file and open in its place the file linkfile.txt really, I'm not interested in nothing more. Do you believe it can be easily accomplished with tkinter, or do I need some more complicated widget? Thanks for any help... alessandro -- View this message in context: http://old.nabble.com/newbie-request-for-help-tp31791699p31791699.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From camfarnell at bitflipper.ca Tue Jun 7 16:05:09 2011 From: camfarnell at bitflipper.ca (Cam) Date: Tue, 07 Jun 2011 11:05:09 -0300 Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <31791699.post@talk.nabble.com> References: <31791699.post@talk.nabble.com> Message-ID: <4DEE3015.5080406@bitflipper.ca> You should be able to accomplish this easily with the tkinter "Text" widget. Cam Farnell On 11-06-07 10:03 AM, alexxxm wrote: > > Hi everybody, > I need some help to understand if tkinter is in fact the right tool to use > for me. > > I intend to write a very bare-bone wiki in python. It should be able to: > > 1) open a text file > 2) display the text file, with links in the form {{image.jpg}} replaced by > the image, and [[linkname|linkfile.txt]] replaced by linkname > 3) when clicking on linkname, save the current text file and open in its > place the file linkfile.txt > > really, I'm not interested in nothing more. > > Do you believe it can be easily accomplished with tkinter, or do I need some > more complicated widget? > > Thanks for any help... > > > alessandro > From Cameron at phaseit.net Tue Jun 7 19:35:49 2011 From: Cameron at phaseit.net (Cameron Laird) Date: Tue, 7 Jun 2011 17:35:49 +0000 Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <4DEE3015.5080406@bitflipper.ca> References: <31791699.post@talk.nabble.com> <4DEE3015.5080406@bitflipper.ca> Message-ID: <20110607173549.GA19537@lairds.us> On Tue, Jun 07, 2011 at 11:05:09AM -0300, Cam wrote: . . . > You should be able to accomplish this easily with the tkinter "Text" widget. > > Cam Farnell > > On 11-06-07 10:03 AM, alexxxm wrote: . . . > >Do you believe it can be easily accomplished with tkinter, or do I need > >some > >more complicated widget? . . . Text() is indeed a powerhouse. Its capabilities might astonish you. In particular, it can do all you describe for your model of a Wiki. While studying Text(), make a point of learning about its powerful notion of "tag". From john at nmt.edu Tue Jun 7 19:23:37 2011 From: john at nmt.edu (John W. Shipman) Date: Tue, 7 Jun 2011 11:23:37 -0600 (MDT) Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <31791699.post@talk.nabble.com> References: <31791699.post@talk.nabble.com> Message-ID: +-- | 1) open a text file | 2) display the text file, with links in the form {{image.jpg}} replaced by | the image, and [[linkname|linkfile.txt]] replaced by linkname | 3) when clicking on linkname, save the current text file and open in its | place the file linkfile.txt +-- Tkinter can do all that. A few suggestions: - You will want to use a Text widget for your main display. Conceptually, this widget displays a sequence of lines of text. An image is treated as a single character: it is displayed on a line between the text that comes before it and the text that comes after it. - Use tags to change the appearance of links so the reader will know they are clickable. You can apply named tags to any number of regions in your Text widget. Each tag is associated with options such as text color, background color, and font. Here's a Tkinter reference that may help you: http://www.nmt.edu/tcc/help/pubs/tkinter Read closely the sections of "The Text Widget", especially the subsections "Text widget tags" and "Methods on Text widgets". In the latter subsection, note these methods: .tag_add: For applying a specific tag to a region of text. .tag_bind: Make regions tagged with a certain tag respond to events such as mouse clicks. .tag_config: Change the appearance of all regions tagged with a certain tag. Best regards, John Shipman (john at nmt.edu), Applications Specialist, NM Tech Computer Center, Speare 119, Socorro, NM 87801, (575) 835-5735, http://www.nmt.edu/~john ``Let's go outside and commiserate with nature.'' --Dave Farber From magni at inrim.it Wed Jun 8 08:42:21 2011 From: magni at inrim.it (alexxxm) Date: Tue, 7 Jun 2011 23:42:21 -0700 (PDT) Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <31791699.post@talk.nabble.com> References: <31791699.post@talk.nabble.com> Message-ID: <31798108.post@talk.nabble.com> I thank you all for your help and I'm looking forward to implement it. At the moment however I'm unable to do it since it appears I'm missing a basic piece: trying to approach the links, at first I used the code found at http://effbot.org/zone/tkinter-text-hyperlink.htm: import tkHyperlinkManager from Tkinter import * root = Tk() root.title("hyperlink-1") text = Text(root) text.pack() hyperlink = tkHyperlinkManager.HyperlinkManager(text) def click1(): print "click 1" text.insert(INSERT, "this is a ") text.insert(INSERT, "link", hyperlink.add(click1)) text.insert(INSERT, "\n\n") def click2(): print "click 2" text.insert(INSERT, "this is another ") text.insert(INSERT, "link", hyperlink.add(click2)) text.insert(INSERT, "\n\n") mainloop() but I get this: ImportError: No module named tkHyperlinkManager I work on Linux Fedora13, and my Tkinter version is tkinter-2.6.4-27.fc13.x86_64 Probably tkHyperlinkManager is not included by default in the Tkinter distribution? As approach #2 I tried this (courtesy of StackOverflow): import Tkinter class App: def __init__(self, root): self.root = root for text in ("link1", "link2", "link3"): link = Tkinter.Label(text=text, foreground="#0000ff") link.bind("<1>", lambda event, text=text: \ self.click_link(event, text)) link.pack() def click_link(self, event, text): print "you clicked '%s'" % text root=Tkinter.Tk() app = App(root) root.mainloop() and this works. Do you recommend this approach? alessandro alexxxm wrote: > > Hi everybody, > I need some help to understand if tkinter is in fact the right tool to use > for me. > > I intend to write a very bare-bone wiki in python. It should be able to: > > 1) open a text file > 2) display the text file, with links in the form {{image.jpg}} replaced by > the image, and [[linkname|linkfile.txt]] replaced by linkname > 3) when clicking on linkname, save the current text file and open in its > place the file linkfile.txt > > really, I'm not interested in nothing more. > > Do you believe it can be easily accomplished with tkinter, or do I need > some more complicated widget? > > Thanks for any help... > > > alessandro > > -- View this message in context: http://old.nabble.com/newbie-request-for-help-tp31791699p31798108.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From magni at inrim.it Wed Jun 8 08:48:41 2011 From: magni at inrim.it (alexxxm) Date: Tue, 7 Jun 2011 23:48:41 -0700 (PDT) Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <31798108.post@talk.nabble.com> References: <31791699.post@talk.nabble.com> <31798108.post@talk.nabble.com> Message-ID: <31798134.post@talk.nabble.com> ooops, I just found out: the code for tkHyperlinkManager is at http://pastebin.com/mWfDm7eZ alessandro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alexxxm wrote: > > I thank you all for your help and I'm looking forward to implement it. > At the moment however I'm unable to do it since it appears I'm missing a > basic piece: > > trying to approach the links, at first I used the code found at > http://effbot.org/zone/tkinter-text-hyperlink.htm: > > import tkHyperlinkManager > from Tkinter import * > > root = Tk() > root.title("hyperlink-1") > > text = Text(root) > text.pack() > > hyperlink = tkHyperlinkManager.HyperlinkManager(text) > > def click1(): > print "click 1" > > text.insert(INSERT, "this is a ") > text.insert(INSERT, "link", hyperlink.add(click1)) > text.insert(INSERT, "\n\n") > > def click2(): > print "click 2" > > text.insert(INSERT, "this is another ") > text.insert(INSERT, "link", hyperlink.add(click2)) > text.insert(INSERT, "\n\n") > > mainloop() > > > > but I get this: > ImportError: No module named tkHyperlinkManager > > I work on Linux Fedora13, and my Tkinter version is > tkinter-2.6.4-27.fc13.x86_64 > Probably tkHyperlinkManager is not included by default in the Tkinter > distribution? > > > As approach #2 I tried this (courtesy of StackOverflow): > > import Tkinter > > class App: > def __init__(self, root): > self.root = root > for text in ("link1", "link2", "link3"): > link = Tkinter.Label(text=text, foreground="#0000ff") > link.bind("<1>", lambda event, text=text: \ > self.click_link(event, text)) > link.pack() > def click_link(self, event, text): > print "you clicked '%s'" % text > > root=Tkinter.Tk() > app = App(root) > root.mainloop() > > > and this works. Do you recommend this approach? > > alessandro > > > > alexxxm wrote: >> >> Hi everybody, >> I need some help to understand if tkinter is in fact the right tool to >> use for me. >> >> I intend to write a very bare-bone wiki in python. It should be able to: >> >> 1) open a text file >> 2) display the text file, with links in the form {{image.jpg}} replaced >> by the image, and [[linkname|linkfile.txt]] replaced by linkname >> 3) when clicking on linkname, save the current text file and open in its >> place the file linkfile.txt >> >> really, I'm not interested in nothing more. >> >> Do you believe it can be easily accomplished with tkinter, or do I need >> some more complicated widget? >> >> Thanks for any help... >> >> >> alessandro >> >> > > -- View this message in context: http://old.nabble.com/newbie-request-for-help-tp31791699p31798134.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From kevin.buchs at gmail.com Wed Jun 8 14:29:50 2011 From: kevin.buchs at gmail.com (Kevin Buchs) Date: Wed, 8 Jun 2011 07:29:50 -0500 Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <31798108.post@talk.nabble.com> References: <31791699.post@talk.nabble.com> <31798108.post@talk.nabble.com> Message-ID: Alessandro, The suggestion on this email list has been to use the Text widget, making use of tags. The second option you gave is going a different direction than that by using Labels. I do not think that will take you where you want to go. It may be that tkHyperlinkManager is the optimal choice when implementing hyperlinked text using Text, but I am unsure. I got the impression through brief review of the dialog here that there was a capability native to Text that would give you what you need. To get tkHyperlinkManager installed here is what I would recommend. If the command easy_install is not currently available, then you may be able to install the corresponding "distutils" module for Python using Fedora's package maintenance capability. Probably installing something like "Python distutils" should do the job. Once that is done then you should have the command easy_install. Then it is simply a matter of using this command line: easy_install tkHyperlinkManager. Depending on the OS setup, you may need to run that as su/sudo to have the permissions to write into the Python packages directories. Kevin From kw at codebykevin.com Wed Jun 8 14:55:39 2011 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 08 Jun 2011 08:55:39 -0400 Subject: [Tkinter-discuss] newbie request for help In-Reply-To: References: <31791699.post@talk.nabble.com> <31798108.post@talk.nabble.com> Message-ID: <4DEF714B.3010507@codebykevin.com> On 6/8/11 8:29 AM, Kevin Buchs wrote: > > To get tkHyperlinkManager installed here is what I would recommend. If > the command easy_install is not currently available, then you may be > able to install the corresponding "distutils" module for Python using > Fedora's package maintenance capability. Probably installing something > like "Python distutils" should do the job. Once that is done then you > should have the command easy_install. Then it is simply a matter of > using this command line: easy_install tkHyperlinkManager. Depending on > the OS setup, you may need to run that as su/sudo to have the > permissions to write into the Python packages directories. tkHyperlinkManager is just a single module at effbot's site. Just copy the code and put it in site-packages. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From Cameron at phaseit.net Wed Jun 8 15:55:03 2011 From: Cameron at phaseit.net (Cameron Laird) Date: Wed, 8 Jun 2011 13:55:03 +0000 Subject: [Tkinter-discuss] newbie request for help In-Reply-To: <4DEF714B.3010507@codebykevin.com> References: <31791699.post@talk.nabble.com> <31798108.post@talk.nabble.com> <4DEF714B.3010507@codebykevin.com> Message-ID: <20110608135503.GB7968@lairds.us> On Wed, Jun 08, 2011 at 08:55:39AM -0400, Kevin Walzer wrote: . . . > >To get tkHyperlinkManager installed here is what I would recommend. If > >the command easy_install is not currently available, then you may be > >able to install the corresponding "distutils" module for Python using > >Fedora's package maintenance capability. Probably installing something > >like "Python distutils" should do the job. Once that is done then you > >should have the command easy_install. Then it is simply a matter of > >using this command line: easy_install tkHyperlinkManager. Depending on > >the OS setup, you may need to run that as su/sudo to have the > >permissions to write into the Python packages directories. > > tkHyperlinkManager is just a single module at effbot's site. Just copy > the code and put it in site-packages. . . . Alessandro, do you understand what Kevin is saying? This is important: *it's just source*, and in this case, brief and simply-organized source. Alessandro, make sure you look over . From yahuip at uchicago.edu Tue Jun 21 04:59:37 2011 From: yahuip at uchicago.edu (yahuip at uchicago.edu) Date: Mon, 20 Jun 2011 21:59:37 -0500 (CDT) Subject: [Tkinter-discuss] how to get all pixels enclosed by a canvas object Message-ID: <20110620215937.AOT51827@mstore02.uchicago.edu> Hi there, I have been struggling to find a way to retrieve all pixel coordinates that are enclosed by an object drawn on a canvas widget. Anyone knows how I can do it? Thanks, Yahui From lionkimbro at gmail.com Tue Jun 21 08:39:24 2011 From: lionkimbro at gmail.com (Lion Kimbro) Date: Mon, 20 Jun 2011 23:39:24 -0700 Subject: [Tkinter-discuss] how to get all pixels enclosed by a canvas object In-Reply-To: <20110620215937.AOT51827@mstore02.uchicago.edu> References: <20110620215937.AOT51827@mstore02.uchicago.edu> Message-ID: I'm not sure what you mean, but perhaps you are looking for: canvas.find_enclosed(x1, y1, x2, y2) => [objID, objID, ...] completely enclosed canvas.find_overlapping(x1, y1, x2, y2) => [objID, objID, ...] sharing at least 1 point ..? On Mon, Jun 20, 2011 at 7:59 PM, wrote: > Hi there, > > I have been struggling to find a way to retrieve all pixel coordinates that > are enclosed by an object drawn on a canvas widget. Anyone knows how I can > do it? > > Thanks, > Yahui > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yahuip at uchicago.edu Tue Jun 21 15:20:01 2011 From: yahuip at uchicago.edu (Peng) Date: Tue, 21 Jun 2011 08:20:01 -0500 Subject: [Tkinter-discuss] how to get all pixels enclosed by a canvas object In-Reply-To: References: <20110620215937.AOT51827@mstore02.uchicago.edu> Message-ID: <1308662401.7780.41.camel@yugong.bsd.uchicago.edu> Thanks for your reply, Lion. What I want to do is to select a region of interest (ROI) in a given image. I can display the image in a canvas widget and use canvas.create_#object#() method to generate an ROI on the screen. However, I could not find a way to get all pixel coordinates inside the ROI. I have found that canvas.coors() returns pixel coordinates but they do not normally form a close contour. What I was wondering is whether there is a simple way to get all pixels inside an object that is created by canvas.create_#object#() method. I see your suggestion is a possible way: get the bbox() return values for the object and test each pixel (or a small box) to see whether or not it is inside the object. But are there easier and more direct ways to do this? Yahui On Mon, 2011-06-20 at 23:39 -0700, Lion Kimbro wrote: > > I'm not sure what you mean, but perhaps you are looking for: > > canvas.find_enclosed(x1, y1, x2, y2) => [objID, objID, ...] > completely enclosed > canvas.find_overlapping(x1, y1, x2, y2) => [objID, objID, ...] > sharing at least 1 point > > ..? > > > On Mon, Jun 20, 2011 at 7:59 PM, wrote: > Hi there, > > I have been struggling to find a way to retrieve all pixel > coordinates that are enclosed by an object drawn on a canvas > widget. Anyone knows how I can do it? > > Thanks, > Yahui > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From lionkimbro at gmail.com Tue Jun 21 19:04:07 2011 From: lionkimbro at gmail.com (Lion Kimbro) Date: Tue, 21 Jun 2011 10:04:07 -0700 Subject: [Tkinter-discuss] how to get all pixels enclosed by a canvas object In-Reply-To: <1308662401.7780.41.camel@yugong.bsd.uchicago.edu> References: <20110620215937.AOT51827@mstore02.uchicago.edu> <1308662401.7780.41.camel@yugong.bsd.uchicago.edu> Message-ID: Are you talking about making, say, a clickable image-map ..? Or perhaps semantic regions? [1] I guess what I'm wondering is: * Why do you need to get all of the pixel coordinates within the region (within the shape,) * ...and: is there an easier way to do what you are wanting to do? For example, if you were wanting to make a clickable image-map, then I'd want to check, "Do you know that you can attach events to clicks on the objects in the canvas?" Or if you are trying to do collision detection, you might want to look at: http://www.rhinocerus.net/forum/lang-tcl/597392-overlapping-items-tk-canvas.html ...or you might want to use canvas.find_overlapping dynamically, rather than getting at the original data, ... (etc.,.) [1] Semantic Regions http://hcil.cs.umd.edu/trs/2004-05/2004-05-revised.pdf On Tue, Jun 21, 2011 at 6:20 AM, Peng wrote: > Thanks for your reply, Lion. > > What I want to do is to select a region of interest (ROI) in a given > image. I can display the image in a canvas widget and use > canvas.create_#object#() method to generate an ROI on the screen. > However, I could not find a way to get all pixel coordinates inside the > ROI. I have found that canvas.coors() returns pixel coordinates but > they do not normally form a close contour. What I was wondering is > whether there is a simple way to get all pixels inside an object that is > created by canvas.create_#object#() method. > > I see your suggestion is a possible way: get the bbox() return values > for the object and test each pixel (or a small box) to see whether or > not it is inside the object. But are there easier and more direct ways > to do this? > > Yahui > > On Mon, 2011-06-20 at 23:39 -0700, Lion Kimbro wrote: > > > > I'm not sure what you mean, but perhaps you are looking for: > > > > canvas.find_enclosed(x1, y1, x2, y2) => [objID, objID, ...] > > completely enclosed > > canvas.find_overlapping(x1, y1, x2, y2) => [objID, objID, ...] > > sharing at least 1 point > > > > ..? > > > > > > On Mon, Jun 20, 2011 at 7:59 PM, wrote: > > Hi there, > > > > I have been struggling to find a way to retrieve all pixel > > coordinates that are enclosed by an object drawn on a canvas > > widget. Anyone knows how I can do it? > > > > Thanks, > > Yahui > > _______________________________________________ > > Tkinter-discuss mailing list > > Tkinter-discuss at python.org > > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yahuip at uchicago.edu Tue Jun 21 19:30:53 2011 From: yahuip at uchicago.edu (Peng) Date: Tue, 21 Jun 2011 12:30:53 -0500 Subject: [Tkinter-discuss] how to get all pixels enclosed by a canvas object In-Reply-To: References: <20110620215937.AOT51827@mstore02.uchicago.edu> <1308662401.7780.41.camel@yugong.bsd.uchicago.edu> Message-ID: <1308677453.7780.89.camel@yugong.bsd.uchicago.edu> The task is straightforward. I want to select a certain region of an image and plot, for example, the distribution of pixel values within that region. Therefore, I want to have the pixels coordinates so that I can select those pixel to get their values. What I am doing now is to use canvas to display the image and define callbacks attached to mouse click events to generate an object that encloses the region I want to have. The trouble I have now is that after I generate a (for example) polygon object in a canvas, I do not know how I can get all pixels enclosed by the polygon object. I am new to Tkinter and I think there must be an easy way to get it done. Thanks, Yahui On Tue, 2011-06-21 at 10:04 -0700, Lion Kimbro wrote: > > > Are you talking about making, say, a clickable image-map ..? > Or perhaps semantic regions? [1] > > I guess what I'm wondering is: > * Why do you need to get all of the pixel coordinates within the > region (within the shape,) > * ...and: is there an easier way to do what you are wanting to do? > > For example, if you were wanting to make a clickable image-map, > then I'd want to check, "Do you know that you can attach events to > clicks > on the objects in the canvas?" > > Or if you are trying to do collision detection, you might want to > look at: > > http://www.rhinocerus.net/forum/lang-tcl/597392-overlapping-items-tk-canvas.html > ...or you might want to use canvas.find_overlapping dynamically, > rather than getting at the original data, ... > > (etc.,.) > > > [1] Semantic Regions > http://hcil.cs.umd.edu/trs/2004-05/2004-05-revised.pdf > > > On Tue, Jun 21, 2011 at 6:20 AM, Peng wrote: > Thanks for your reply, Lion. > > What I want to do is to select a region of interest (ROI) in a > given > image. I can display the image in a canvas widget and use > canvas.create_#object#() method to generate an ROI on the > screen. > However, I could not find a way to get all pixel coordinates > inside the > ROI. I have found that canvas.coors() returns pixel > coordinates but > they do not normally form a close contour. What I was > wondering is > whether there is a simple way to get all pixels inside an > object that is > created by canvas.create_#object#() method. > > I see your suggestion is a possible way: get the bbox() return > values > for the object and test each pixel (or a small box) to see > whether or > not it is inside the object. But are there easier and more > direct ways > to do this? > > Yahui > > > On Mon, 2011-06-20 at 23:39 -0700, Lion Kimbro wrote: > > > > I'm not sure what you mean, but perhaps you are looking > for: > > > > canvas.find_enclosed(x1, y1, x2, y2) => [objID, > objID, ...] > > completely enclosed > > canvas.find_overlapping(x1, y1, x2, y2) => [objID, > objID, ...] > > sharing at least 1 point > > > > ..? > > > > > > On Mon, Jun 20, 2011 at 7:59 PM, > wrote: > > Hi there, > > > > I have been struggling to find a way to retrieve all > pixel > > coordinates that are enclosed by an object drawn on > a canvas > > widget. Anyone knows how I can do it? > > > > Thanks, > > Yahui > > _______________________________________________ > > Tkinter-discuss mailing list > > Tkinter-discuss at python.org > > > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > > > > From python at bdurham.com Thu Jun 23 14:18:28 2011 From: python at bdurham.com (python at bdurham.com) Date: Thu, 23 Jun 2011 08:18:28 -0400 Subject: [Tkinter-discuss] Autocomplete example on wiki Message-ID: <1308831508.3486.1466392801@webmail.messagingengine.com> I'm looking for a way to add autocomplete functionality to my Windows based Tkinter applications running under Python 2.7 (32-bit). I've started by using code found on the wiki, but I'm open to other suggestions as well. Ideally I'd like a solution that works with the ttk.Entry widget. Here's the link to the wiki's auto-complete widget that I'm trying to get to work. [1]http://tkinter.unpythonic.net/wiki/AutocompleteEntry When I run the code on this page, I receive the following traceback: C:\test>py27 tkautocomplete.py Type a 't' to test the AutocompleteEntry widget. Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', u'tre e', u'time')) Try also the backspace key and the arrow keys. Traceback (most recent call last): File "tkautocomplete.py", line 99, in test(test_list) File "tkautocomplete.py", line 89, in test entry.set_completion_list(test_list) File "tkautocomplete.py", line 35, in set_completion_list self.bind('', self.handle_keyrelease) AttributeError: AutocompleteEntry instance has no attribute 'handle_keyrelease' The traceback complains about a missing handle_keyrelease attribute which is present in the sample code. I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 Professional. Thank you, Malcolm References 1. http://tkinter.unpythonic.net/wiki/AutocompleteEntry -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Fri Jun 24 15:24:14 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Fri, 24 Jun 2011 15:24:14 +0200 Subject: [Tkinter-discuss] Autocomplete example on wiki In-Reply-To: <1308831508.3486.1466392801@webmail.messagingengine.com> References: <1308831508.3486.1466392801@webmail.messagingengine.com> Message-ID: Hi, Tried the code here on Windows 7 using Python 2.7.1, no problem at all. Given that the method handle_keyrelease is explicitly defined in the code at http://tkinter.unpythonic.net/wiki/AutocompleteEntry, my guess is that you have modified the code somehow such that it doesn't work, or changed indentation, or.... Can you send me the code you are running, and I will check it out? Mick On Thu, Jun 23, 2011 at 2:18 PM, wrote: > I'm looking for a way to add autocomplete functionality to my Windows based > Tkinter applications running under Python 2.7 (32-bit). > > I've started by using code found on the wiki, but I'm open to other > suggestions as well. Ideally I'd like a solution that works with the > ttk.Entry widget. > > Here's the link to the wiki's auto-complete widget that I'm trying to get to > work. > http://tkinter.unpythonic.net/wiki/AutocompleteEntry > > When I run the code on this page, I receive the following traceback: > > C:\test>py27 tkautocomplete.py > Type a 't' to test the AutocompleteEntry widget. > Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', > u'tre > e', u'time')) > Try also the backspace key and the arrow keys. > Traceback (most recent call last): > ? File "tkautocomplete.py", line 99, in > ??? test(test_list) > ? File "tkautocomplete.py", line 89, in test > ??? entry.set_completion_list(test_list) > ? File "tkautocomplete.py", line 35, in set_completion_list > ??? self.bind('', self.handle_keyrelease) > AttributeError: AutocompleteEntry instance has no attribute > 'handle_keyrelease' > > The traceback complains about a missing handle_keyrelease attribute which is > present in the sample code. > > I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 > Professional. > > Thank you, > Malcolm > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From michael.odonnell at uam.es Fri Jun 24 20:17:15 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Fri, 24 Jun 2011 20:17:15 +0200 Subject: [Tkinter-discuss] Autocomplete example on wiki In-Reply-To: References: <1308831508.3486.1466392801@webmail.messagingengine.com> Message-ID: Dear Malcom, Having looked at your version of the code, I see that the method: def handle_keyrelease(self, event) is indented one tab too far. If you are in Idle, select all of the method, and select "Dedent Region" from the Format menu. Then it should work. Mick On Fri, Jun 24, 2011 at 3:24 PM, Michael O'Donnell wrote: > Hi, > > ?Tried the code here on Windows 7 using Python 2.7.1, > no problem at all. > > Given that the method handle_keyrelease is explicitly defined > in the code at http://tkinter.unpythonic.net/wiki/AutocompleteEntry, > my guess is that you have modified the code somehow such that > it doesn't work, or changed indentation, or.... > > Can you send me the code you are running, and I will check it out? > > Mick > > On Thu, Jun 23, 2011 at 2:18 PM, ? wrote: >> I'm looking for a way to add autocomplete functionality to my Windows based >> Tkinter applications running under Python 2.7 (32-bit). >> >> I've started by using code found on the wiki, but I'm open to other >> suggestions as well. Ideally I'd like a solution that works with the >> ttk.Entry widget. >> >> Here's the link to the wiki's auto-complete widget that I'm trying to get to >> work. >> http://tkinter.unpythonic.net/wiki/AutocompleteEntry >> >> When I run the code on this page, I receive the following traceback: >> >> C:\test>py27 tkautocomplete.py >> Type a 't' to test the AutocompleteEntry widget. >> Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', >> u'tre >> e', u'time')) >> Try also the backspace key and the arrow keys. >> Traceback (most recent call last): >> ? File "tkautocomplete.py", line 99, in >> ??? test(test_list) >> ? File "tkautocomplete.py", line 89, in test >> ??? entry.set_completion_list(test_list) >> ? File "tkautocomplete.py", line 35, in set_completion_list >> ??? self.bind('', self.handle_keyrelease) >> AttributeError: AutocompleteEntry instance has no attribute >> 'handle_keyrelease' >> >> The traceback complains about a missing handle_keyrelease attribute which is >> present in the sample code. >> >> I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 >> Professional. >> >> Thank you, >> Malcolm >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > From python at bdurham.com Sat Jun 25 18:57:26 2011 From: python at bdurham.com (python at bdurham.com) Date: Sat, 25 Jun 2011 12:57:26 -0400 Subject: [Tkinter-discuss] Autocomplete example on wiki In-Reply-To: References: <1308831508.3486.1466392801@webmail.messagingengine.com> Message-ID: <1309021046.31771.1467166013@webmail.messagingengine.com> Dear Mick, > Having looked at your version of the code, I see that the method: def handle_keyrelease(self, event) is indented one tab too far. Thank you for taking the time to uncover the problem in my code. I can't believe I missed that indentation error! Thanks again! Malcolm