本文整理汇总了Python中turtle.clear函数的典型用法代码示例。如果您正苦于以下问题:Python clear函数的具体用法?Python clear怎么用?Python clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: tegnGitter
def tegnGitter(i0,i1,j0,j1):
"""Gitteret har søjler fra i0 til og med i1 og rækker fra
j0 til og med j1. Først blankstilles lærredet"""
xmin,ymin = toXY(i0,j0)
xlen,ylen = (i1-i0+2)*cs,(j1-j0+2)*cs
tt.clear()
tt.penup()
tt.color(kodefarve[4])
# vandrette linjer
x,y = xmin-cs/2,ymin
tt.setheading(0) # øst
for j in range(j0,j1+2):
tt.goto(x,y)
tt.pendown()
tt.forward(xlen)
tt.penup()
y += cs
# lodrette linjer
x,y = xmin,ymin-cs/2
tt.setheading(90) # nord
for i in range(i0,i1+2):
tt.goto(x,y)
tt.pendown()
tt.forward(ylen)
tt.penup()
x += cs
开发者ID:androidYibo,项目名称:documents,代码行数:26,代码来源:kursusuge5modul.py
示例2: alpha_beta_helper
def alpha_beta_helper():
global state, root, alpha_time
initialize()
print("PLEASE WAIT!!!")
root = TreeNode(-1000)
time1 = time.time()
alpha_beta(root, 1, state)
init_screen()
drawLine()
drawGrid()
drawColumns()
drawRows()
caliberate()
col = root.ans
row = -1
turtle.onscreenclick(goto)
for i in range(4):
if state[i][col] == 0:
row = i
break
state[row][col] = 1
drawDot(row, col, 1)
var = (int)(input("Enter 1 to continue playing or 0 to stop."))
time2 = time.time()
alpha_time = time2-time1
if(var == 1):
turtle.clear()
turtle.goto(0, 0)
turtle.penup()
turtle.right(270)
alpha_beta_helper()
else:
write_analysis(3)
开发者ID:krnbatra,项目名称:AI-Assignments,代码行数:33,代码来源:assign2.py
示例3: main
def main():
ap = ArgumentParser()
ap.add_argument('--speed', type=int, default=10,
help='Number 1-10 for drawing speed, or 0 for no added delay')
ap.add_argument('program')
args = ap.parse_args()
for kind, number, path in parse_images(args.program):
title = '%s #%d, path length %d' % (kind, number, path.shape[0])
print(title)
if not path.size:
continue
pen_up = (path==0).all(axis=1)
# convert from path (0 to 65536) to turtle coords (0 to 655.36)
path = path / 100.
turtle.title(title)
turtle.speed(args.speed)
turtle.setworldcoordinates(0, 655.36, 655.36, 0)
turtle.pen(shown=False, pendown=False, pensize=10)
for i,pos in enumerate(path):
if pen_up[i]:
turtle.penup()
else:
turtle.setpos(pos)
turtle.pendown()
turtle.dot(size=10)
_input('Press enter to continue')
turtle.clear()
turtle.bye()
开发者ID:perimosocordiae,项目名称:pyhrm,代码行数:29,代码来源:extract_images.py
示例4: display
def display(self):
turtle.clear()
# draws all live cells from grid.state
for i in range(self.xspan):
for j in range(self.yspan):
self.draw(i, j)
turtle.update()
开发者ID:Nagoogin,项目名称:game-of-life,代码行数:7,代码来源:gameOfLife.py
示例5: nextGeneration
def nextGeneration(self, step=True):
self.refreshCanvas()
self.dirty = True
turtle.TurtleScreen._RUNNING = True
self.screen.clear()
self.screen.mode("standard")
self.state = RUNNING
self.selected = []
self.configGUI(DISABLED, DISABLED, DISABLED, DISABLED, NORMAL, DISABLED,
"Drawing, please wait...", "red")
if step:
self.ge.set_fitnesses(self.fitness)
self.ge.step()
self.myt = MyTurtle(650, 650, 3, 3)
turtle.clear()
for i in range(self.n):
for j in range(self.m):
self.setUnselected(i, j)
#Drawing l-system
# phenotype = 'angle=6%d\ndepth=%d\nstep_size=10\ncircle_angle=20.5\naxiom=F\nF=F-F++F-F'%((i*j),(i*j))
phenotype = self.ge.individuals[i*self.n+j].phenotype
valid = self.draw_phenotype(
phenotype,
self.myt.index_to_pixel(i, "x") + self.myt.xside_box / 2.0,
self.myt.index_to_pixel(j, "y") + self.myt.yside_box / 2.0,
self.myt.xside,
self.myt.yside)
if not valid:
self.setInvalid(i, j)
self.configGUI(NORMAL, NORMAL, NORMAL, NORMAL, DISABLED, DISABLED, INSTRUCTIONS)
self.set_listeners()
开发者ID:ElliotGluck,项目名称:ponyge,代码行数:35,代码来源:gui.py
示例6: draw_l
def draw_l(word):
turtle.up()
turtle.clear()
turtle.setposition(0, 0)
turtle.setheading(0)
turtle.bk(INITIAL_POS[0])
turtle.down()
turtle.st()
stack = []
for char in word:
if char == '0':
turtle.fd(SIZE[0])
if char == '1':
turtle.fd(SIZE[0])
if char == '[':
stack.append((turtle.position(), turtle.heading()))
turtle.lt(45)
if char == ']':
position, heading = stack.pop()
turtle.up()
turtle.setposition(position)
turtle.setheading(heading)
turtle.rt(45)
turtle.down()
turtle.ht()
开发者ID:RichardBarrell,项目名称:snippets,代码行数:25,代码来源:draw_l.py
示例7: Run
def Run():
#bounds
nearRange = [0, 50]
farRange = [50, 200]
frusHL = 100
#Logic
nearDist = random.uniform(nearRange[0], nearRange[1])
farDist = random.uniform(farRange[0], farRange[1])
d = frusHL * 2
an = nearDist
af = farDist
b = (d*d + af*af - an*an) / (2 * d)
radius = math.sqrt(b*b + an*an)
originY = -frusHL + b
#text.insert('end', 'Origin: %d\n' % originY)
#Render
turtle.clear()
turtle.hideturtle()
turtle.tracer(0, 0)
turtle.penup()
turtle.goto(-farDist, frusHL)
turtle.pendown()
turtle.goto(-nearDist, -frusHL)
turtle.goto(nearDist, -frusHL)
turtle.goto(farDist, frusHL)
turtle.goto(-farDist, frusHL)
turtle.penup()
DrawCircle(0, originY, radius);
turtle.update()
开发者ID:int-Frank,项目名称:DgLib,代码行数:32,代码来源:FrustumMinBoungingSphere.py
示例8: message
def message(m1, m2): # 메시지를 화면에 표시하는 함수
t.clear()
t.goto(0, 100)
t.write(m1, False, "center", ("", 20))
t.goto(0, -100)
t.write(m2, False, "center", ("", 15))
t.home()
开发者ID:hubls,项目名称:p2_201611092,代码行数:7,代码来源:Turtle+Run+Game.py
示例9: animate_fw
def animate_fw(slide1, slide2):
for i in range(100):
turtle.clear()
draw_slide(slide1[0],slide1[1],-885+(i*8.85),0)
draw_slide(slide2[0],slide2[1],i*8.85,0)
turtle.update()
return
开发者ID:nitros12,项目名称:slideshow_py,代码行数:7,代码来源:python+slideshow.py
示例10: loop
def loop(x,y):
if -50<x<50 and -5<y<45:
turtle.clear()
play()
else:
turtle.showturtle()
turtle.goto(x, y)
开发者ID:BCasaleiro,项目名称:Tic-tac-toe,代码行数:7,代码来源:Galo.py
示例11: display
def display(self):
"""Draw the whole board"""
turtle.clear()
for i in range(self.xsize):
for j in range(self.ysize):
self.draw(i, j)
turtle.update()
开发者ID:MattRijk,项目名称:algorithms,代码行数:7,代码来源:conway_game_of_life.py
示例12: main
def main(x,y):
turtle.clear();
j();
a();
z();
d();
e();
e();
p();
开发者ID:jrotithor,项目名称:CS_160,代码行数:9,代码来源:name.py
示例13: cleargraph
def cleargraph():
global outwin
try:
outwin.destroy()
except:
None
turtle.clear()
gridlines(True)
return
开发者ID:hchasestevens,项目名称:chasestevens.com,代码行数:9,代码来源:turtlegraph.py
示例14: keys
def keys():
turtle.clear()
turtle.speed(0)
turtle.pencolor("black")
turtle.pu()
paint (-250,325)
turtle.goto(0,0)
turtle.pd()
turtle.speed(9)
pensize=5
开发者ID:neta16-meet,项目名称:MEET-YL1,代码行数:10,代码来源:meetconf.py
示例15: main
def main(loop_on, dots):
#dots = int(input("How many dots? "))
while loop_on:
turtle_setup()
draw_random_dots(dots)
turtle.clear()
print("")
if not loop_on:
turtle_setup()
draw_random_dots(dots)
开发者ID:mcpnicolas,项目名称:random-animation,代码行数:10,代码来源:draw_random_dots.py
示例16: setGoal
def setGoal(turtle) :
turtle.pencolor("Black")
turtle.color("Black")
turtle.clear()
rangeX=turtle.window_width()/2-110
rangeY=turtle.window_height()/2-110
pos=(random.uniform(-rangeX, rangeX), random.uniform(-rangeY, rangeY))
drawSquare(turtle, pos, 100)
turtle.pencolor("WHITE")
turtle.color("WHITE")
return pos
开发者ID:jhMoon1115,项目名称:p1_201111222,代码行数:11,代码来源:turtleGame_v1.0.py
示例17: drawShape
def drawShape(self, s, l):
angle = 360 / s # Calculating the angle to turn the turtle
# For the number of sides
for i in range(0, s):
turtle.down() # Put the pen down
turtle.forward(l) # Move the turtle forward (l)
turtle.right(angle) # Turn the turtle angle (angle)
time.sleep(self.wait) # turtle.exitonclick() doesn't seem to work (Error: object has no attribute 'exitonclick') so I've just put a sleep in there
turtle.clear() # Clearing the screen
开发者ID:jacobwarduk,项目名称:h008-soton-uni-python-homework,代码行数:11,代码来源:turtle-shape-drawing.py
示例18: draw
def draw(self):
xa,ya=self.pA
xb,yb=self.pB
xc,yc=self.pC
turtle.up()
turtle.goto(int(xa)*100,int(ya)*100)
turtle.down()
turtle.goto(int(xb)*100,int(yb)*100)
turtle.goto(int(xc)*100,int(yc)*100)
turtle.goto(int(xa)*100,int(ya)*100)
turtle.clear()
开发者ID:mosest,项目名称:11th-Python,代码行数:11,代码来源:15.2+-+Triangle+Bonus.py
示例19: up
def up() :
if(len(info["tracks"])==1) :
turtle.clear()
turtle.fd(100)
pos=turtle.pos()
info["tracks"].append(pos)
if(info["goalPos"][0]<=pos[0]<=info["goalPos"][0]+100 and info["goalPos"][1]<=pos[1]<=info["goalPos"][1]+100) :
info["point"]+=1
turtle.write("Done. Your point is "+str(info["point"]))
time.sleep(2)
reset(goal, turtle, info)
开发者ID:jhMoon1115,项目名称:p1_201111222,代码行数:11,代码来源:turtleGame_v0.5.py
示例20: drawPile
def drawPile(matrix):
'''sends turtle to starting position, draws pile, then sends the turtle
back to the starting position'''
clear() # clears canvas to reduce RAM clogging
matrixDim = (DOTSIZE+1)*len(matrix)
pu()
goto(-matrixDim,matrixDim)
for i in range(0,len(matrix)):
for j in range(0,len(matrix[0])):
drawEntry(i,j,matrix,DOTSIZE)
forward(2*DOTSIZE+DOTSIZE//4)
goto(-matrixDim,matrixDim-(2*DOTSIZE+DOTSIZE//4)*(i+1))
开发者ID:crellison,项目名称:Sandpile-Matrix,代码行数:12,代码来源:SandpileMatrix.py
注:本文中的turtle.clear函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论