当前位置: 首页>>代码示例>>Python>>正文


Python Picture.getWidth方法代码示例

本文整理汇总了Python中picture.Picture.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Python Picture.getWidth方法的具体用法?Python Picture.getWidth怎么用?Python Picture.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在picture.Picture的用法示例。


在下文中一共展示了Picture.getWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getWidth [as 别名]
def main():
    pic = Picture("crayons.bmp")
    WIDTH = pic.getWidth()
    HEIGHT = pic.getHeight()
    print(WIDTH, HEIGHT)
    pic2 = copyImage(pic)
    input()
开发者ID:acheney,项目名称:python-labs,代码行数:9,代码来源:tester.py

示例2: main

# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getWidth [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.")
开发者ID:henrylg94,项目名称:python-labs,代码行数:41,代码来源:RecPic.py

示例3: main

# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getWidth [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()
开发者ID:acheney,项目名称:python-labs,代码行数:18,代码来源:imageedit.py

示例4: draw_rgb

# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getWidth [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):
开发者ID:prakashpaudel,项目名称:mathart,代码行数:33,代码来源:test.py


注:本文中的picture.Picture.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。