Пример #1
0
def updateTypeMenu(event):
    """Called as the typeMenu command"""

    nGonSlider.grid_remove()
    trapezoidSlider.grid_remove()
    parallelogramSlider.grid_remove()
    kiteSlider.grid_remove()
    generalSlider.grid_remove()

    global shape
    global shapeMessage
    global v

    r = 2
    c = 0

    if v.get() == 'Default':
        shape = Shape.Default()
        shapeMessage = "Default shape: a square\n"
        update()
    elif v.get() == 'Regular N-gon':
        nGonSlider.grid(row=r, column=c)
        updateNGonSlider(None)
    elif v.get() == 'Trapezoid':
        trapezoidSlider.grid(row=r, column=c)
        updateTrapezoidSlider(None)
    elif v.get() == 'Parallelogram':
        parallelogramSlider.grid(row=r, column=c)
        updateParallelogramSlider(None)
    elif v.get() == 'Kite':
        kiteSlider.grid(row=r, column=c)
        updateKiteSlider(None)
    elif v.get() == 'General':
        generalSlider.grid(row=r, column=c)
        generalSlider.set(shape.length)
        updateGeneralSlider(None)
Пример #2
0
from PVector import *
import Shape
from Tkinter import *
import Tkinter, Tkconstants, tkFileDialog
import colorsys
import os
import errno
from PolyVector import *
import subprocess
import shlex
from threading import Thread
from math import sin, cos, pi
import random

# In the Manager, if trying to create, we will construct a shape. Defaults to Shape.default()
shape = Shape.Default()
N = shape.length  # number of vertices in default shape

# To be updated as shape updates
shapeMessage = ""  # reported on screen, including exact coordinates of vertices of shape
C = None  # average position
R = 0  # max distance of the set of vertices from their average position
m = 0.1  # canvas margin term, proportion of R
w = 0  # width of screen in geometrical units
h = w  # height of screen in geometrical units
canvas_width = 300  # absolute width of screen in drawing units
canvas_height = 300  # absolute height of screen in drawing units
centerPos = PVector(canvas_width / 2, canvas_height / 2)

# Where to store any generated files. Creates this directory if it does not already exist
dirName = sys.argv[1]