Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73237
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <izecksohn@yahoo.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'canvas': 0.07; 'tkinter': 0.07; '(self,': 0.09; '__init__': 0.09; 'canvas.': 0.09; 'pixel': 0.09; 'pixels': 0.09; 'subject:skip:t 10': 0.09; 'width': 0.09; 'def': 0.12; 'random': 0.14; '(0,': 0.16; '250)': 0.16; 'idea:': 0.16; 'script,': 0.16; 'self.y': 0.16; 'subject:Lines': 0.16; 'url:py': 0.16; 'y):': 0.16; 'thursday,': 0.16; 'all.': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'differ': 0.19; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'this?': 0.23; 'specify': 0.24; '(or': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'point': 0.28; 'resolution': 0.29; "doesn't": 0.30; 'code': 0.31; 'lines': 0.31; 'that.': 0.31; 'dimensions': 0.31; 'horizontal': 0.31; 'pa,': 0.31; 'file': 0.32; 'class': 0.32; 'another': 0.32; 'url:python': 0.33; '-----': 0.33; 'level.': 0.33; 'skip:# 10': 0.33; 'could': 0.34; 'display': 0.35; 'board': 0.35; 'point.': 0.35; 'prepare': 0.35; 'but': 0.35; 'there': 0.35; 'format.': 0.36; 'height': 0.36; 'method': 0.36; 'shows': 0.36; 'should': 0.36; 'application': 0.37; 'too': 0.37; 'turn': 0.37; 'email addr:python.org': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'subject:': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'received:bf1.yahoo.com': 0.60; 'received:mail.bf1.yahoo.com': 0.60; 'color': 0.61; 'show': 0.63; 'high': 0.63; 're:': 0.63; 'email name:python-list': 0.65; 'here': 0.66; 'header:Reply-To:1': 0.67; 'received:98.139.212': 0.68; 'therefore': 0.72; 'received:bullet.mail.bf1.yahoo.com': 0.74; 'blow': 0.84; 'draws': 0.84; 'everything.': 0.84; 'otten': 0.84; 'received:98.139.212.152': 0.84 |
| X-Yahoo-Newman-Property | ymail-3 |
| X-Yahoo-Newman-Id | 279152.3557.bm@omp1008.mail.bf1.yahoo.com |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1402604268; bh=09QIR83IMg7wkGR7KmUhED40V5OsdbryJlSA9VeL2yk=; h=References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=P53W104HuNKJvZLaLST5HrV9IgfWxbKSyWSd7jec8YOrYqWg1TZw/GEtlOuEp9tCKwF02txhXd6trEFCL9n/uJsIwyy6Q6bfotGCkD/ZNwDU9IFD284o1Uj5d0kyU+0RVIr1DAJ9ubEaguvgExlozaus0IOWfhhtXmcA6+SGMyA= |
| X-YMail-OSG | 7bgho0sVM1lOVTAbBy4EdpbxYST6O6EJD3J2BHOGdwXwPEY MfTcn6MZDeuJWSSWq5iOgMc.mumiOypyhpbIBKlZC5uoyCKUpDLqEDGx7Nuq C02iDEB1u6fPa4osli72JsOfhPRQOAcPYrh7menLRnKN6y3pFLOfZWLOYqHh 0gz03BIseCgdjRw7umEq36k8lwsM4DHGgUjCK_7uheChixXSjwimY5JVhro9 lDYzZjNkVZT1qYRNzr3kQETDN8hQBfPHeO8gbykMfiJTlysjkPGvIDrcQTSr csOcAMnP.X88LgwB_z3uQYMJeaVSFg09Q.6TjAeEnoWDibw8k93jc4r7jE2H T64nJCAARY1aHu9k_IXy_Z7p97fcGVYd7dpzPpzyCTudAZzd9uxV_Cwar.f. Wwat3NiTeZjM3aHehltp_8tYBCX_0Ydqa9ZTL3H22hUIBKMVCZbWapAyxM9U eKD1lp.91InZQEFx2T6GTs7WOoJILnnZzisl53ScS6ogrpO1TnVW6Z0xK.Tn Du.jCVO.lPvmRNBIf0oVWwo6H8xr1QnwyVhMQwg9HWAJuKIpB5CugXkbJivr Czl_UphdoVAJgoUNq2XSXPNf3AnQ4M49w71Bhkliv6PVKd9mrcZ.dXZQHRQn axRjaCh42MxVEWi9ntTwsFHDAaooeXiw.v215vlcWCIj3O_e4gQTtrk5P |
| X-Rocket-MIMEInfo | 002.001, wqAgQXMgUGV0ZXIgT3R0ZW4gZGlkIG5vdCBzZWUgdGhlIHNhbWUgcmVzdWx0IHRoYXQgSSBzYXcsIEkgcHJlcGFyZWQgYW4gaW1hZ2UgdGhhdCBzaG93cyB0aGUgcmVzdWx0IG9uIG15IG5vdGVib29rOgpodHRwOi8vaXplY2tzb2huLmNvbS9wZWRyby9weXRob24vY2FudmFzL3RrX3dpbmRvdy54Y2YKwqAgRm9yIHRob3NlIHRoYXQgbWlnaHQgbm90IGtub3c6IHhjZiBpcyB0aGUgR2ltcCdzIGZpbGUgZm9ybWF0LgoKCi0tLS0tIE9yaWdpbmFsIE1lc3NhZ2UgLS0tLS0KPiBGcm9tOiBQZXRlciBPdHRlbgo.IFQBMAEBAQE- |
| X-Mailer | YahooMailWebService/0.8.190.668 |
| References | <1402538245.73470.YahooMailNeo@web140102.mail.bf1.yahoo.com> <lnbjak$p92$1@ger.gmane.org> |
| Date | Thu, 12 Jun 2014 13:17:48 -0700 (PDT) |
| From | Pedro Izecksohn <izecksohn@yahoo.com> |
| Subject | Re: Lines on a tkinter.Canvas |
| To | "python-list@python.org" <python-list@python.org> |
| In-Reply-To | <lnbjak$p92$1@ger.gmane.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Mailman-Approved-At | Thu, 12 Jun 2014 22:28:41 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | Pedro Izecksohn <izecksohn@yahoo.com> |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11042.1402604922.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1402604922 news.xs4all.nl 2899 [2001:888:2000:d::a6]:51489 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:73237 |
Show key headers only | View raw
As Peter Otten did not see the same result that I saw, I prepared an image that shows the result on my notebook:
http://izecksohn.com/pedro/python/canvas/tk_window.xcf
For those that might not know: xcf is the Gimp's file format.
----- Original Message -----
> From: Peter Otten
> To: python-list@python.org
> Sent: Thursday, June 12, 2014 4:02 AM
> Subject: Re: Lines on a tkinter.Canvas
>
> Pedro Izecksohn wrote:
>
>> The code available from:
>> http://izecksohn.com/pedro/python/canvas/testing.py
>> draws 2 horizontal lines on a Canvas. Why the 2 lines differ on thickness
>> and length?
>>
>> The Canvas' method create_line turns on at least 2 pixels. But I want
> to
>> turn on many single pixels on a Canvas. How should I do this? Canvas has
>> no method create_pixel or create_point.
>
>> #!/usr/bin/python3
>>
>> import tkinter as tk
>>
>> class Point ():
>> def __init__ (self, x, y):
>> self.x = x
>> self.y = y
>>
>> class Board (tk.Frame):
>> def __init__ (self, bg, dimensions):
>> tk.Frame.__init__ (self, tk.Tk())
>> self.pack()
>> self.canvas = tk.Canvas (self, bd = 0, bg = bg, width = dimensions.x,
> height = dimensions.y)
>> self.canvas.pack (side = "top")
>> def drawLine (self, pa, pb, color):
>> self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color)
>> def drawPoint (self, p, color):
>> self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color)
>>
>> dimensions = Point (500, 500)
>> board = Board ('black', dimensions)
>> color = 'red'
>> p = Point (0, 250)
>> while (p.x < dimensions.x):
>> board.drawPoint (p, color)
>> p.x += 1
>> pa = Point (0, 350)
>> pb = Point (499, 350)
>> board.drawLine (pa, pb, color)
>> board.mainloop()
>
> I just tried your script, and over here the line drawn with
>
>> def drawLine (self, pa, pb, color):
>> self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color)
>
> has a width of 1 pixel and does not include the end point. Therefore the
> "line" drawn with
>
>> def drawPoint (self, p, color):
>> self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color)
>
> does not show up at all. You could try to specify the line width explicitly:
>
> def drawPoint (self, p, color):
> self.canvas.create_line (p.x, p.y, p.x+1, p.y, fill=color, width=1)
>
> If that doesn't work (or there's too much overhead) use pillow to
> prepare an
> image and show that.
>
> Another random idea: if you have a high resolution display your OS might
> blow up everything. In that case there would be no fix on the application
> level.
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Lines on a tkinter.Canvas Pedro Izecksohn <izecksohn@yahoo.com> - 2014-06-12 13:17 -0700
csiph-web