本文整理汇总了Python中turtle.bye函数的典型用法代码示例。如果您正苦于以下问题:Python bye函数的具体用法?Python bye怎么用?Python bye使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bye函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
while True:
side = input("Please enter the total length of the figure: ")
try:
side = int(side)
except:
print('Please enter a valid number.\n')
continue
break
while True:
id = input("Please enter MSU ID (including the starting letter): ")
if len(id) == 9 and id[0].isalpha() and all(d.isdigit() for d in id[1:]):
break
else:
print('Please enter a valid MSU ID.\n')
continue
turtle.colormode(1.0)
turtle.speed(0)
drawQ1(id, side/2)
drawQ2(id, side/2)
drawQ3(id, side/2)
drawQ4(id, side/2)
time.sleep(20)
turtle.bye()
示例2: main
def main():
size=100
initializeSpace()
drawV(size)
giveSpace(size)
drawI(size)
giveSpace(size)
drawS(size)
giveSpace(size)
drawH(size)
giveSpace(size)
drawA(size)
giveSpace(size)
moveUp(size)
drawL(size)
changeSpace(size)
drawG(size)
giveSpace(size)
drawA(size)
giveSpace(size)
drawR(size)
giveSpace(size)
moveUp(size)
drawG(size)
t.hideturtle()
input("Press ENTER/RETURN")
turtle.bye()
return
示例3: main
def main():
pen = turtle.Turtle()
lines = [Line((0,0),(40,20)), Line((0,20), (40,0), "red")]
print(lines)
for line in lines:
print (line, end=" ")
line.draw(pen)
print()
p = Polygon([(100,0),(200,0),(200,50),(100,50)], fillcolor="blue")
p.draw(pen)
print (p)
t = Triangle((10,20),(20,0),(0,0),'black','blue')
t.draw(pen)
print (t)
r = Rectangle([(-50,0),(0,50)],fillcolor = 'red')
r.draw(pen)
print(r)
c = Circle((-50,0),100,fillcolor = 'red', pencolor = 'blue')
c.draw(pen)
print(c)
pen.hideturtle()
time.sleep(5)
turtle.bye()
示例4: 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()
示例5: skapur
def skapur():
print("Voo! Þú fannst lykill og fékkst aðgang að þessu herbergi!")
print("Þú labbar inn í herbergið og þú sérð skáp og rúm")
svarsvar1= input("Hvort viltu opna skápinn með lyklinnum eða kíkja undir rúmið?(opna skáp/undir rúm)")
if(svarsvar1=='opna skáp'):
breki = turtle.Turtle()
breki.speed(10)
for i in range(10):
breki.forward(100)
breki.right(30)
breki.forward(20)
breki.left(60)
breki.forward(50)
breki.right(30)
breki.penup()
breki.setposition(0, 0)
breki.pendown()
breki.right(2)
turtle.bye()
turtle.bye()
svarsvar1=input("Jey! þú fannst hlutinn! labba út eða kíkja undir rúmið?(labba út/kíkja undir rúm")
if svarsvar1=="labba út":
pass
if(svarsvar1=='kíkja undir rúm'):
print("Þú gramsar undir rúminnu og finnur hlutinn úr herbergi 34!")
示例6: main
def main():
"""
The main function.
:pre: pos (0,0), heading (east), up
:post: pos (
0,0), heading (east), up
:return: None
"""
init()
drawY()
drawSpace()
drawA()
drawSpace()
drawS()
drawSpace()
drawH()
drawSpace()
drawSpace()
drawJ()
drawSpace()
drawA()
drawSpace()
drawI()
drawSpace()
drawN()
drawSpace()
hideTurtle()
input('Hit enter to close...')
turtle.bye()
示例7: main
def main():
#uses functions to graph the data
t = turtle.Turtle()
t.hideturtle()
drawLine(t,0,0,300,0) #draw x axis
t.hideturtle()
drawLine(t,0,0,0,300) #draw y axis
#draws the dotted lines
x1 = 0
for i in range(5):
x1 += 50
if (i+1) < len(male):
dottedLine(t,x1,male[i]*5,x1+50,male[i+1]*5,colorP='red')
if (i+1) < len(female):
dottedLine(t,x1,female[i]*5,x1+50,female[i+1]*5,colorP='blue')
tickMarks(t)
labels(t)
time.sleep(5)
turtle.bye()
示例8: demanderLongueur
def demanderLongueur():
try:
cote = int(turtle.textinput("Longeurs","Entrez une longueur en px qui constitura la taille de votre carré, tapez q pour quitter"))
return cote
except ValueError:
print("Vous n'avez pas entré un nombre. Je quitte.")
turtle.bye()
sys.exit()
示例9: pleindre
def pleindre(self):
"""Appelé pour protester"""
print('Vous pouvez protester')
dire = input('Entrez votre message: ')
try:
self.protester(dire)
except:
print("Vous quitter la partie suite à votre protestation")
turtle.bye()
示例10: main
def main():
"""
The program creates draws a ring of hexagons and
waits for the user to respond before terminating.
"""
initialize()
drawRing(100)
input("Hit ENTER to finish the program.")
turtle.bye()
示例11: main
def main():
"""The program creates a picture canvas, draws a tiktaktoeboard with the Xs and Os, hides the turtle and
waits for the user to respond before terminating.
"""
initialize()
drawFace()
turtle.hideturtle()
input( "Hit ENTER to finish the program." )
turtle.bye()
示例12: main
def main():
"""The program creates a picture canvas, draws a homework thingy, hides the turtle and
waits for the user to respond before terminating.
"""
initialize()
drawFace()
turtle.hideturtle()
input( "Hit ENTER to finish the program." )
turtle.bye()
示例13: testTurtle
def testTurtle(p,f):
#installed Pillow for screen capture
#https://pypi.python.org/pypi/Pillow/2.1.0#downloads
try:
myTurtle=imp.load_source('myMath',p+'/myTurtle.py')
except Exception as e:
print('\t\t',e, file=f)
wn = turtle.Screen()
t = turtle.Turtle()
t.speed(0)
try:
myTurtle.draw_name( wn, t )
except Exception as e:
print('\t\t',e, file=f)
t.speed(0)
try:
myTurtle.draw_axes( wn, t )
except Exception as e:
print('\t\t',e, file=f)
t.speed(0)
try:
myTurtle.draw_line( wn, t, -3, 5 )
except Exception as e:
print('\t\t',e, file=f)
my_goto( t,200, 200 )
try:
myTurtle.draw_triangle( wn, t, 50 )
except Exception as e:
print('\t\t',e, file=f)
my_goto( t,200, -200 )
try:
myTurtle.draw_square( wn, t, 50 )
except Exception as e:
print('\t\t',e, file=f)
my_goto( t,-200, 200 )
try:
myTurtle.draw_pent( wn, t, 50 )
except Exception as e:
print('\t\t',e, file=f)
try:
name=p.split('/')[-1]
ImageGrab.grab().save(name+'.jpg', "JPEG")
except Exception as e:
print('\t\t',e, file=f)
turtle.bye()
print('\t\tmyTurtle finished.',file=f)
示例14: main
def main():
initBannerCanvas( 2, 2 )
letter_library.drawLetter( "S" )
letter_library.drawLetter( "s" )
turtle.left( 180 )
turtle.forward( 60 )
turtle.left( 90 )
turtle.forward( 30 )
turtle.left( 90 )
letter_library.drawLetter( "I" )
letter_library.drawLetter( "i" )
input( "Strike enter. " )
turtle.bye()
示例15: main
def main():
t = turtle.Turtle()
outside(t)
hair(t)
eye_height = 100
eye_offset = 60
eye_radius = 25
drawEye( t, eye_height, eye_offset, eye_radius )
drawEye( t, eye_height, -eye_offset, eye_radius )
input("Press enter to quit")
turtle.bye()