descartes.py

Created by gasmat2012

Created on January 18, 2026

581 Bytes

Same as Kandinsky, but (0, 0) is located on the middle of the screen, or (160, 111) in Kandinsky coordinates. Needs draw_line.py to draw straight lines for the line() function.


def pix(x,y,color):
  import kandinsky
  kandinsky.set_pixel(160+x,111-y,color)

def get(x,y):
  import kandinsky
  return kandinsky.get_pixel(160+x,111-y)

def color(*col):
  import kandinsky
  return kandinsky.color(col)

def string(text,x,y,col=(0,)*3,hcol=(255,)*3):
  import kandinsky
  return kandinsky.draw_string(text,160+x,111-y,col,hcol)

def fill(x,y,w,h,col):
  import kandinsky
  kandinsky.fill_rect(160+x,111-y,w,h,col)

def line(x0,y0,x1,y1,col,bgcol,alias=False):
  import draw_line
  draw_line.drawLine(160+x0,111-y0,160+x1,111-y1,col,bgcol,alias)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.