Skip to content

Commit 98dca7a

Browse files
committed
Added eyes.py
1 parent e5407f3 commit 98dca7a

File tree

4 files changed

+67
-12
lines changed

4 files changed

+67
-12
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,36 @@ def draw():
266266
pass
267267
```
268268

269+
## Eyes
270+
271+
```
272+
python ppython.py snippets/eyes.py
273+
```
274+
275+
![](ppython/images/ppython_eyes.jpg)
276+
277+
code:
278+
279+
```python
280+
def setup():
281+
size = 100
282+
noStroke()
283+
284+
fill(255)
285+
stroke(0)
286+
ellipse(150, 150, 100, 200)
287+
fill(255)
288+
ellipse(250, 150, 100, 200)
289+
290+
fill(0)
291+
ellipse(225, 250, 25, 25)
292+
ellipse(325, 250, 25, 25)
293+
294+
def draw():
295+
pass
296+
```
297+
298+
269299
# Docs
270300

271301
### constants

ppython/dump/dump.py

+21-12
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def polygon(self):
4545
self.canvas.create_polygon(self.points, width=self.StrokeSize_, fill=self.Fill_,
4646
outline=self.Stroke_)
4747

48+
def text(self, string, x, y):
49+
self.canvas.create_text(x, y, text=string)
50+
4851
def line(x, y, x2, y2):
4952
_p.line(x, y, x2, y2)
5053

@@ -154,6 +157,9 @@ def dist(x1, y1, x2, y2):
154157
squared_delta_y = (y2 - y1) ** 2
155158
return sqrt(squared_delta_x + squared_delta_y)
156159

160+
def text(string, x, y):
161+
_p.text()
162+
157163

158164

159165
from tkinter import *
@@ -167,27 +173,30 @@ def dist(x1, y1, x2, y2):
167173

168174
def setup():
169175
global width, height, mouseX, mouseY
170-
print(dist(0, 0, 0, 100))
176+
size = 100
177+
noStroke()
178+
179+
fill(255)
180+
stroke(0)
181+
ellipse(150, 150, 100, 200)
182+
fill(255)
183+
ellipse(250, 150, 100, 200)
184+
185+
fill(0)
186+
ellipse(225, 250, 25, 25)
187+
ellipse(325, 250, 25, 25)
171188

172189
def draw():
173190
global root, width, height, mouseX, mouseY
174191
mouseX = _p.mouseX; mouseY = _p.mouseY
175-
#background(100)
176-
noStroke()
177-
fill(random(255))
178-
ellipse(10, 10, 100, random(50, 100))
192+
pass
193+
179194
root.after(30, draw)
180195
setup()
181196
draw()
182197

183-
#self.canvas.create_rectangle(20, 50, 200, 100, outline="black", fill="red", width=2, stipple="gray50")
184-
#fill("orange")
185-
#ircle(10, 10)
186-
# ################
187-
188198
def motion(event):
189199
_p.mouseX, _p.mouseY = event.x, event.y
190-
#print('{}, {}'.format(x, y))
191200

192201
root.bind('<Motion>', motion)
193-
root.mainloop()
202+
root.mainloop()

ppython/images/ppython_eyes.jpg

14.3 KB
Loading

ppython/snippets/eyes.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def setup():
2+
size = 100
3+
noStroke()
4+
5+
fill(255)
6+
stroke(0)
7+
ellipse(150, 150, 100, 200)
8+
fill(255)
9+
ellipse(250, 150, 100, 200)
10+
11+
fill(0)
12+
ellipse(225, 250, 25, 25)
13+
ellipse(325, 250, 25, 25)
14+
15+
def draw():
16+
pass

0 commit comments

Comments
 (0)