Questions tagged [zelle-graphics]

A simple object oriented graphics library for Python under the GPL license. The library is intended for novice programmers and teaching purposes and features basic geometric objects such as lines, circles or polygons. Use this tag for specific programming questions about creating graphics with the Zelle-graphics library.

Zelle-graphics is a simple object oriented graphics library designed to make it very easy for novice programmers to experiment with computer graphics in an object oriented fashion. It was written by John M. Zelle for use with the book Python Programming: An Introduction to Computer Science Third Edition (Python 3.x) — Franklin, Beedle & Associates 2016-Aug-08)

The library provides the following graphical objects:
  Point
  Line
  Circle
  Oval
  Rectangle
  Polygon
  Text
  Entry (for text-based input)
  Image

The most recent version of the library can be obtained at:

http://mcsp.wartburg.edu/zelle/python

177 questions
2
votes
1 answer

Moving Python graphics.py objects

I'm trying to move two objects at the same time in python graphics (This seems to be referring to John Zelle's graphics.py), then repeat the movement in a loop. However when I try to loop it, the shapes disappear. How can I fix this? def main(): …
user3817694
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

Unable to display coordinates after polygon drawn in Zelle graphics.py

Am able to successfully draw a polygon using Zelle graphics.py in Python, but I was unable to display the coordinates for the points used. How can I get it done using getPoints() only. Here's my code: import math import graphics #must be…
Macrick
  • 37
  • 9
2
votes
1 answer

Python - have drawn a game board, how to color the "border"?

I created a game board: win = GraphWin ("Gameboard",500,500) win.setCoords(0.0,0.0,10.0,10.0) drawBoard(win) for i in range(10): Line(Point(0,i),Point(10,i)).draw(win) for x in range(10): Line(Point(x,0),Point(x,10)).draw(win) I have a…
user2113818
  • 829
  • 1
  • 9
  • 12
1
vote
0 answers

Zelle graphics keyboard input fails when using multiple windows

There seems to be a keyboard input problem with Zelle Graphics when using multiple windows. Mouse operations work fine but not keyboard operations. It seems that when the 2nd window is opened, keyboard input from the 1st window goes to the object…
Jay Mosk
  • 197
  • 1
  • 2
  • 8
1
vote
1 answer

graphics: How to draw new objects on the screen once it's already up?

I'm making an interactive map for my class, using Zelle's graphics.py . I got the map , and the data all set, but I can't figure out how to get the graphics window to update and draw new objects (route markers) on the map, after recieving user…
1
vote
1 answer

Mouse Coordinates in Graph Window

I'm trying to figure out how to find the mouse coordinates when clicking on the graph window a few times. So far I've tried mx ,my = win.mouseX(), win.mouseY() and it tells me that the Nonetype is not callable. I've seen other posts involving…
IcyG
  • 19
  • 4
1
vote
1 answer

Rotating shapes with zelle (in python)

I have done a code (using John Zelles's graphics module and python 3.10.0) and it works just fine, but the problem is that it needs to rotate 90 degrees anti-clockwise, and I don't know how to do it. I have posted a picture of the final result I got…
Mr Mister
  • 13
  • 2
1
vote
1 answer

Is there an event listener in the Zelle graphics module?

Is there an event listener when using graphics.py (Zelle) and Python? With turtle graphics there is: onkeypress. With pygame there is: if event.key == pygame.K_w:. I am hoping to find something that will work in a similar manner using graphics.py.
netrate
  • 423
  • 2
  • 8
  • 14
1
vote
1 answer

Zelle and Graphics.py - how can I keep the graphic window always on top?

Using graphics.py, I am wondering if there is a way to keep the graphics.py canvas/window on top the entire time. When using pycharm, if the input is in pycharm - the graphic gets hidden behind the application. I found a way of doing it in turtle,…
netrate
  • 423
  • 2
  • 8
  • 14
1
vote
1 answer

Trying to move the traffic light in a loop when clicking the mouse with Zelle graphics module

from graphics import * def trafficlight(): win = GraphWin() box = Rectangle(Point(75, 25), Point(125, 175)) box.draw(win) yellow = Circle(Point(100,100), 25) yellow.setFill('yellow') red = Circle(Point(100,50), 25) red.setFill('red') …
blue123
  • 13
  • 2
1
vote
2 answers

Control location on screen where new windows open with graphics.py

I have a python program that deploys a windows via graphics.py. The initial window opened by the GraphWin class opens in the top left corner of the screen. Subsequent calls to GraphWin cascade from the upper left to the lower right. I'd like to…
Iggy
  • 33
  • 6
1
vote
1 answer

Make multiple shapes work together in Zelle Graphics

I'm a beginner in Python and I'm using the Zelle's Graphics library. I wish to draw multiple shapes and make them behave as one. For example, I might call a group of shapes 'x' and when I use the builtin move() method the entire collection of…
senya247
  • 23
  • 1
  • 5
1
vote
1 answer

Zelle-graphics window — Cloning object instead of moving

I'm making a simulation of a traffic light and a car. When the light turns green, the car should move. (I'm aware that actual stoplights don't jump from green to red, or from red to yellow, but...just go with it). The program takes input from the…
G Y
  • 21
  • 1
  • 5
1
vote
1 answer

Creating a line which goes through a point and rotates about the point until it hits another point, which causes it to rotate about the new point

I decided to create a visualization of the second problem on the 2011 Math Olympiad competition. I need to create a line which passes through a point, and once it intersects a different point, I need it to rotate about it. More info:…
JamesC
  • 11
  • 3
1
vote
2 answers

Generate and place random points inside a circle

I have a task where I am supposed to create a circle and plot some random points inside it. I am new to Python and Python libraries. I need some suggestions about different software or packages that might help me with my task. I have seen some…
Fragger98
  • 33
  • 7
1
2
3
11 12