-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
228 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pygame>=2.0.0 | ||
pygame>=2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
# Just import everything | ||
# Импортируем всё | ||
from drawzero import * | ||
# | ||
# # Red rectangle with upper left corner at (50, 150) and width = 900, height = 700 | ||
# # Красный прямоугольник с левым верхнем углом в точке(50, 150), шириной 900 и высотой 700 | ||
# rect('red', (50, 150), 900, 700) | ||
# | ||
# # Straight orange line from (100, 500) to (900, 500) | ||
# # Оранжевая прямая линия из точки (100, 500) в точку (900, 500) | ||
# line('orange', (100, 500), (900, 500)) | ||
# | ||
# # Centered text | ||
# # Центрированный текст | ||
# text('green', 'Hello world!', (500, 250), fontsize=72) | ||
# text('blue', 'Привет, мир!', (500, 750), fontsize=72) | ||
|
||
from drawzero import * | ||
# Red rectangle with upper left corner at (50, 150) and width = 900, height = 700 | ||
# Красный прямоугольник с левым верхнем углом в точке(50, 150), шириной 900 и высотой 700 | ||
rect('red', (50, 150), 900, 700) | ||
|
||
# Straight orange line from (100, 500) to (900, 500) | ||
# Оранжевая прямая линия из точки (100, 500) в точку (900, 500) | ||
line('orange', (100, 500), (900, 500)) | ||
|
||
# Centered text | ||
# Центрированный текст | ||
text('green', 'Hello world!', (500, 250), fontsize=72) | ||
text('blue', 'Привет, мир!', (500, 750), fontsize=72) | ||
|
||
# help(line) | ||
set_lang('en') | ||
line('red', 300, 400, 1, 2, ) | ||
# Run loop | ||
# Запуск | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from drawzero import * | ||
|
||
# just coordinates | ||
A = Pt(100, 100) | ||
B = Pt(300, 150) | ||
line(C.red, A, B) | ||
|
||
# A point which acts as 2-d vector and as a Turtle | ||
# Pt(x=0.0, y=0.0, *, heading=0.0) | ||
# | ||
# Provides (for a, b — points, k number): | ||
# * arithmetic | ||
# a+b — vector addition | ||
# a-b — vector subtraction | ||
# k*a and a*k — multiplication with scalar | ||
# abs — absolute value of a | ||
# +a, -a | ||
|
||
# arithmetic | ||
A = Pt(100, 200) | ||
dx = Pt(50, 5) | ||
for i in range(10): | ||
filled_circle(C.blue, A + dx * i, radius=10) | ||
|
||
# * turtle-style movement | ||
# forward — Move the point forward by the specified distance. | ||
# backward — Move the point backward by distance. | ||
# right — Turn point right by angle degrees. | ||
# left — Turn point left by angle degrees. | ||
# goto — Move point to an absolute position. | ||
# rotate_around — Rotate around given point by angle degrees. | ||
# move_towards — Move towards the given point by the specified distance. | ||
# reset, home — Move point to the origin - coordinates (0,0), set heading=0 | ||
# setx — Set the point's first coordinate to x | ||
# sety — Set the point's second coordinate to y | ||
# setheading — Set the point's heading | ||
|
||
A = Pt(100, 300) | ||
B = Pt(1000, 400) | ||
for i in range(10): | ||
filled_circle(C.green2, A, radius=10) | ||
A.move_towards(50, B) | ||
|
||
A = Pt(100, 400) | ||
for i in range(10): | ||
filled_circle(C.magenta, A, radius=10) | ||
A.left(10).forward(30) | ||
|
||
# * information | ||
# position — Return the point's current location (x,y), as a tuple. | ||
# x, xcor — Return the point's x coordinate. | ||
# y, ycor — Return the point's y coordinate | ||
# heading — Return the point's heading | ||
# distance — Return the distance between points | ||
# towards — Return the angle towards point | ||
# * deep copy | ||
# copy — a clone of point |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from drawzero import * | ||
|
||
|
||
scale1 = Gradient([C.black, C.white], 0, 1000) | ||
for x in range(0, 1000, 10): | ||
filled_rect(scale1(x), (x, 0), 10, 100) | ||
text(C.white, 'scale1 = Gradient([C.black, C.white], 0, 1000)', (50, 100), 48, '<^') | ||
|
||
scale2 = Gradient([C.green, C.yellow, C.magenta, C.red], 0, 1000) | ||
for x in range(0, 1000, 10): | ||
filled_rect(scale2(x), (x, 200), 10, 100) | ||
text(C.white, 'scale2 = Gradient([C.green, C.yellow, C.magenta, C.red], 0, 1000)', (50, 300), 32, '<^') | ||
|
||
scale3 = Gradient([C.white, C.black, C.red, C.black, C.white], 200, 800) | ||
for x in range(0, 1000, 10): | ||
filled_rect(scale3(x), (x, 400), 10, 100) | ||
text(C.white, 'scale3 = Gradient([C.white, C.black, C.red, C.black, C.white], 200, 800)', (50, 500), 32, '<^') |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import traceback | ||
import sys | ||
|
||
os.environ['EJUDGE_MODE'] = 'true' | ||
|
||
from drawzero import * | ||
|
||
filled_circle('boo') | ||
# line('nocolor', (100, 100), ('asdf',)) | ||
circle('red', (100, 100), 'asd', line_width=0) | ||
|
||
|
||
class ExceptionPrinter: | ||
def __enter__(self): | ||
pass | ||
|
||
def __exit__(self, exc_type, exc_value, exc_traceback): | ||
if exc_traceback: | ||
traceback_len = 0 | ||
cur = exc_traceback | ||
while cur: | ||
traceback_len += 1 | ||
cur = cur.tb_next | ||
print(f'Traceback is {traceback_len} deep') | ||
print(''.join(traceback.format_tb(exc_traceback)), end='') | ||
print(exc_value) | ||
return True | ||
|
||
|
||
# import drawzero | ||
# print(help(drawzero)) | ||
# exit() | ||
# | ||
# | ||
s = ExceptionPrinter() | ||
|
||
with s: line('nocolor', (100, 100), (200, 200)) | ||
with s: line(C.red, (100, 200), (200, 'baz')) | ||
with s: rect('violet', (100, 200, 300, 'baz')) |