本文整理汇总了Python中picture.Picture.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Python Picture.getHeight方法的具体用法?Python Picture.getHeight怎么用?Python Picture.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类picture.Picture
的用法示例。
在下文中一共展示了Picture.getHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getHeight [as 别名]
def main():
pic = Picture("crayons.bmp")
WIDTH = pic.getWidth()
HEIGHT = pic.getHeight()
print(WIDTH, HEIGHT)
pic2 = copyImage(pic)
input()
示例2: main
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getHeight [as 别名]
def main():
canvas = Picture((512, 512))
w = canvas.getWidth()
h = canvas.getHeight()
canvas.setPenColor(0, 255, 0)
print("Welcome to the fractal image generator.")
print()
print("We have 4 fractals for you to choose from:")
print("1. Bubble")
print("2. Carpet")
print("3. Gasket")
print("4. Snowflake")
print()
k = eval(input("Please enter the number corresponding to the image you would like to see: "))
n = eval(input("How many times would you like it to recurse? "))
if k == 1:
bubble(0, 0, w, h, n, 0, canvas).display()
if k == 2:
carpet(0, 0, w, h, n, canvas).display()
if k == 3:
canvas.fillPoly((0, w // 2, w - 1), (h - 1, 0, h - 1))
canvas.setPenColor(0, 0, 0)
gasket(0, 0, w, h, n, canvas).display()
if k == 4:
# make a canvas with width and height being a power of 3.
canvas = Picture((468, 468))
canvas.setPenColor(0, 255, 0)
w = canvas.getWidth()
h = canvas.getHeight()
canvas.setPosition(w // 6, 4 * h // 6)
canvas = snowflake(n, 3 * w // 4, canvas)
canvas.rotate(240)
canvas = snowflake(n, 3 * w // 4, canvas)
canvas.rotate(240)
canvas = snowflake(n, 3 * w // 4, canvas)
canvas.rotate(240)
canvas.display()
input("Press enter to end the program.")
示例3: main
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getHeight [as 别名]
def main():
name = input("Enter the filename of an image you would like to edit: ")
pic = Picture(name)
pic.display()
WIDTH = pic.getWidth()
HEIGHT = pic.getHeight()
instructions()
while True:
options()
userInput = input("Enter the number corresponding to the change you want to perform: ")
if userInput == "exit":
return
else:
userInput = eval(userInput)
pic = doEdit(userInput, pic)
pic.display()
示例4: draw_rgb
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getHeight [as 别名]
pMain = path.path(path.moveto(x,y+hCornerCenter), path.lineto(x+.5,y-hCenter),
path.lineto(x-.5,y-hCenter), path.closepath())
c.stroke(pMain, [deco.filled([get_color("black")])])
#draw r,g,b triangles
pRed = draw_rgb(c,x,y,"red",0,r)
pGreen = draw_rgb(c,x,y,"green",1,g)
pBlue = draw_rgb(c,x,y,"blue",2,b)
fill_intersections(c,pRed,pGreen,pBlue,r,g,b)
#Main Commands
c = canvas.canvas()
p = Picture("whitetriangle.jpg")
width, height = p.getWidth(), p.getHeight()
##for xp in range(width):
## for yp in range(height):
## rp,gp,bp = p.getPixelColor(xp,yp)
## r, g, b = floor(rp/25.6),floor(gp/25.6),floor(bp/25.6)
#### print (xp,yp,r,g,b)
##
## draw_triangle(c,xp,(height-yp)*h,r,g,b)
#All possible values
##count=0
##for i in range(0,L):
## for j in range(0,L):
## for k in range(0,L):