これは私のコード全体です:
from Graphics import *
import random
import time
from Myro import *
pt = Point(100,50)
pink = makeColor(200,100,150)
black = makeColor(0,0,0)
red = makeColor(255, 0, 0)
green = makeColor(0, 255, 0)
blue = makeColor(0, 0, 255)
purple = makeColor(255, 0, 255)
orange = makeColor(255, 153, 0)
win = Window("name", 1000, 500)
p1 = Point(0,0)
p2 = Point(200, 300)
p3 = Point(200,0)
d3 = Dot(p3)
p4 = Point(400, 300)
d4 = Dot(p4)
p5 = Point(400, 0)
p6 = Point(600, 300)
p7 = Point(600, 0)
p8 = Point(800,300)
p9 = Point(800,0)
p0 = Point(1000, 300)
win.setBackground(pink)
class Classes(object):
WIDTH = 200
HEIGHT = 300
five = Rectangle(p9, p0)
five.setOutline(black)
five.setFill(orange)
five.draw(win)
four = Rectangle(p7, p8)
four.setOutline(black)
four.setFill(purple)
four.draw(win)
three = Rectangle(p5, p6)
three.setOutline(black)
three.setFill(blue)
three.draw(win)
two = Rectangle(p3, p4)
two.setOutline(black)
two.setFill(green)
two.draw(win)
one = Rectangle(p1, p2)
one.setOutline(black)
one.setFill(red)
one.draw(win)
'''def __init__(self,p,win):
def numClasses(self):
num = ask("How many classes do you have? Enter a number 1-5")
int(num)
if num == 1:
def askOne(self):
one = ask'''
'''class classOne(Classes):
def __init__(self, win):
Classes.__init__(self, win)
self.appearance.setFill(red)
self.appearance.setOutline(black)'''
#self.append(win)
class classTwo(Classes):
def __init__(self, win):
Classes.__init__(self,win)
self.appearance= Text(Point(100, 10), "Class 1")
self.appearance.fontSize = 10
self.appearance.setFill(black)
self.appearance.draw(win)
win.flip()
class classThree(Classes):
def __init__(self, win):
Classes.__init__(self, win)
self.appearance.setFill(blue)
self.appearance.setOutline(black)
class classFour(Classes):
def __init__(self, win):
Classes.__init__(self, win)
self.appearance.setFill(orange)
self.appearance.setOutline(black)
class classFive(Classes):
def __init__(self, win):
Classes.__init__(self, win)
self.appearance.setFill(purple)
self.appearance.setOutline(black)
t = time.strftime("%Y-%m-%d")
ti = Text(Point(win.getWidth()/2, 475), t)
ti.fontSize = 26
ti.setFill(black)
ti.draw(win)
title = Text(Point(win.getWidth()/2, 440), "Schedule for the week of:")
title.setFill(black)
title.fontSize = 20
title.draw(win)
classes = []
別のこと、ウィンドウは私が使用しているバージョンの関数です。事前定義されているため、定義できません。描画できる別のウィンドウ (1000 x 500) ピクセルが開くだけです。クラスの下に入力されたときにテキストを表示する方法を知る必要があります。長方形/ポイント/シェイプでは機能しますが、テキストでは機能しません。どうしてか分かりません。