June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,34 @@
from turtle import *
colors = ["black", "red", "green", "blue", "magenta", "cyan", "yellow", "white"]
# Middle of screen is 0,0
screen = getscreen()
left_edge = -screen.window_width()//2
right_edge = screen.window_width()//2
quarter_height = screen.window_height()//4
half_height = quarter_height * 2
speed("fastest")
for quarter in range(4):
pensize(quarter+1)
colornum = 0
min_y = half_height - ((quarter + 1) * quarter_height)
max_y = half_height - ((quarter) * quarter_height)
for x in range(left_edge,right_edge,quarter+1):
penup()
pencolor(colors[colornum])
colornum = (colornum + 1) % len(colors)
setposition(x,min_y)
pendown()
setposition(x,max_y)
notused = input("Hit enter to continue: ")

View file

@ -0,0 +1,66 @@
# Project : Colour pinstripe/Display
# Date : 2018/01/05
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
load "guilib.ring"
paint = null
new qapp
{
win1 = new qwidget() {
setwindowtitle("archimedean spiral")
setgeometry(100,100,500,600)
label1 = new qlabel(win1) {
setgeometry(10,10,400,400)
settext("")
}
new qpushbutton(win1) {
setgeometry(150,500,100,30)
settext("draw")
setclickevent("draw()")
}
show()
}
exec()
}
func draw
p1 = new qpicture()
color = new qcolor() {
setrgb(0,0,255,255)
}
pen = new qpen() {
setcolor(color)
setwidth(1)
}
paint = new qpainter() {
begin(p1)
setpen(pen)
w = 100
h = 100
color = list(8)
color[1] = [0 ,0, 0]
color[2] = [255, 0, 0]
color[3] = [0, 255, 0]
color[4] = [0, 0, 255]
color[5] = [255, 0, 255]
color[6] = [0, 255, 255]
color[7] = [255, 255, 0]
color[8] = [255, 255, 255]
y = h*4
for p = 1 to 4
y = y - h
for x = 0 to w step 4*p
col = random(7) + 1
color2 = new qcolor()
color2.setrgb(color[col][1],color[col][2],color[col][3],255)
mybrush = new qbrush() {setstyle(1) setcolor(color2)}
setbrush(mybrush)
paint.drawrect(x, y, 2*p, h)
next
next
endpaint()
}
label1 { setpicture(p1) show() }

View file

@ -0,0 +1,30 @@
require('GD')
func pinstripes(width = 1280, height = 720) {
var im = %O<GD::Image>.new(width, height)
var colors = [0, 255].variations_with_repetition(3)
var paintcolors = colors.shuffle.map {|rgb|
im.colorAllocate(rgb...)
}
var starty = 0
var barheight = height//4
for barwidth in (1..4) {
for (
var(startx = 0, colorindex = 0);
startx + barwidth <= width;
startx += barwidth
) {
im.filledRectangle(startx, starty, startx+barwidth,
starty + barheight - 1, paintcolors[colorindex++ % 8])
}
starty += barheight
}
return im
}
File('pinstripes.png').write(pinstripes().png, :raw)