Skip to content

Commit

Permalink
width setting added
Browse files Browse the repository at this point in the history
  • Loading branch information
williamnavaraj committed Jun 4, 2022
1 parent cfe1708 commit cd5df42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ipyturtle3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
from .ipyturtle3 import Turtle, Canvas, TurtleScreen,hold_canvas, Shape

__version__ = "0.1.3"
__version__ = "0.1.4"
__author__ = 'William Navaraj'
__homepage__ = 'https://github.com/williamnavaraj'
__all__ =['Turtle','Canvas','TurtleScreen','hold_canvas','Shape']
9 changes: 8 additions & 1 deletion ipyturtle3/ipyturtle3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# ipyturtle3.py: an ipycanvas based turtle graphics module for Python
# implemented as wrapper around turtle.py which ships with python
# Version 0.1.3 - 19. 5. 2022
# Version 0.1.4 - 04. 06. 2022
#
# Copyright [2022] [William Navaraj]

Expand Down Expand Up @@ -332,7 +332,10 @@ def _update(self):
if i["ID"]==0:
self.cv.fill_style=self.cv.background_color
self.cv.fill_rect(0, 0, self.cv.canvwidth, self.cv.canvheight)
self.cv.line_width=1.0
elif i["Type"]=="Polygon":
if i['Width'] !="":
self.cv.line_width=float(i['Width'])
if i['Fill'] !="":
self.cv.fill_style=i['Fill']
if i['Outline'] != "":
Expand All @@ -341,14 +344,18 @@ def _update(self):
pg=[(L[i]+self.cv.canvwidth/2,L[i+1]+self.cv.canvheight/2) for i in range(0, len(L),2)]
self.cv.fill_polygon(pg)
self.cv.stroke_polygon(pg)
self.cv.line_width=1.0
elif i["Type"]=="Line":
if i['Width'] !="":
self.cv.line_width=float(i['Width'])
if i['Fill'] !="":
self.cv.fill_style=i['Fill']
self.cv.stroke_style=i['Fill']
L=i["LineSegments"]
if (len(L)>=4):
pg=[(L[i]+self.cv.canvwidth/2,L[i+1]+self.cv.canvheight/2) for i in range(0, len(L),2)] #[L[0]+self.cv.canvwidth/2,L[1]+self.cv.canvheight/2, L[2]+self.cv.canvwidth/2,L[3]+self.cv.canvheight/2 ]
self.cv.stroke_lines(pg)
self.cv.line_width=1.0
elif i["Type"]=="Image":
if(i["isNull"]==False):
#pass
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='ipyturtle3',
version='0.1.3',
version='0.1.4',
description='Turtle graphics based on ipycanvas which can run on jupyter lab/notebook/vscode. ',
url='https://github.com/williamnavaraj/ipyturtle3.git',
author='William Navaraj',
Expand Down

0 comments on commit cd5df42

Please sign in to comment.