Moving multiple objects using Python and Java

Introduction to Python 3

Python is a high level object oriented programming language that closely related to languages such as Java and C #. While it is a useful coding system, it is also one of the easiest to learn. The basic Python functions such as print statements are same or similar to other languages. This language is currently (as of November 2012) being used by banks, industrial automation, video games and many more. However, if you are planing to learn a programming language, I recommend C++ over Python 3.

User driven data for objects movement

The following program will draw a face with several parameters (triangle, circles, ellipses, etc) on a black background in quickdraw.jar.

You must download the quickdraw program and install Java in the run time environment. You can download Java here. If you are on 64-bit OS, you may want to download the 64-bit version at here. The quickdraw program is written in Java and can be downloaded here (original author Dr. Ben Stephenson) or here (sanuja.com).

# Written by by: M. Sanuja Senanayake
# SourceCode.py - Java pipe function is used to input the output of this Python 3 code
# The input will be displayed in quickdraw window with default black background.
# The objective of this program is to create a "face" that can move around the quickdraw 
# window according to user driven inputs.
#
# To run this program, enter: phython3 SourceCode.py | java -jar quickdraw.jar
#
# Prompt for user input for left and right positions and importing the standard error for text input
#
import sys
sys.stderr.write("Position with respect to left/right please: ")
x_pos = int(float(input()))
sys.stderr.write("Position with respect to up/down please: ")
y_pos = int(float(input()))
#
# face configuration
#
print ("colour 131 111 255") # face colour
print ("fillcircle" ,x_pos, y_pos,"251 face") # face
#
# the right eye configuration
#
print ("colour 51 0 51")
print ("fillellipse" ,x_pos+100, y_pos-110,"145 50 right_eye")
print ("colour 92 172 255")#inside right eye
print ("fillcircle" ,x_pos+100, y_pos-110,"20 right_eye_inside")
#
# the left eye configuration
#
print ("colour 51 0 51")
print ("fillellipse" ,x_pos-100, y_pos-110,"145 50 left_eye")
print ("colour 92 172 255")#inside left eye
print ("fillcircle" ,x_pos-100, y_pos-110,"20 left_eye_inside")
#
# mouth configuration
#
print ("colour 186 85 211")
print ("fillarc" ,x_pos-100, y_pos+75,"200 100 180 180 chord mouth")
#
# tongue configuration
#
print ("color 128 0 0")
print ("fillellipse" ,x_pos-0, y_pos+160,"30 61 ellipse")
#
# nose configuration
#
print ("colour 0 00 225")
print("fillpolygon" ,x_pos-50, y_pos+60, x_pos+50, y_pos+60, x_pos-0, y_pos-0, "nose")