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


Python Picture.close方法代码示例

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


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

示例1: main

# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import close [as 别名]
def main():
    try:
        print("Welcome to the Image Editor!  Here you can apply many transformations to you pictures!")
        file = input("Please enter the file name of the image you wish to change:")
        canvas = Picture(file)
        canvas.display()
        print("1. Flip Horizontally")
        print("2. Mirror Horizontally")
        print("3. Scroll Horizontally")
        print("4. Make Negative")
        print("5. Make Grayscale")
        print("6. Cycle Color Channels")
        print("7. Zoom")
        print("8. Posterize")
        print("9. Change Brightness")
        print("10. Increase Contrast")
        print("11. Blur")
        print("12. Rotate 180 Degrees")
        print("13. ???")
        print("14. ???")
        n = eval(input("Enter the number corresponding with the effect you want (or enter 0 to end the program):"))
        while n!=0:
            if n==1:
                canvas = flipHorizontally(canvas)
                canvas.display()
            elif n==2:
                canvas = mirrorHorizontally(canvas)
                canvas.display()
            elif n==3:
                canvas = scrollHorizontally(canvas)
                canvas.display()
            elif n==4:
                canvas = makeNegative(canvas)
                canvas.display()
            elif n==5:
                canvas = makeGrayscale(canvas)
                canvas.display()
            elif n==6:
                canvas = cycleColorChannels(canvas)
                canvas.display()
            elif n==7:
                canvas = zoom(canvas)
                canvas.display()
            elif n==8:
                canvas = posterize(canvas)
                canvas.display()
            elif n==9:
                canvas = changeBrightness(canvas)
                canvas.display()
            elif n==10:
                canvas = increaseContrast(canvas)
                canvas.display()
            elif n==11:
                canvas = blur(canvas)
                canvas.display()
            elif n==12:
                canvas = rotate180(canvas)
                canvas.display()
            elif n==13:
                canvas = negativeFlip(canvas)
                canvas.display()
            elif n==14:
                canvas = negativeMirror(canvas)
                canvas.display()
            elif n==0:
                break
            else:
                print("")
                print("Please enter one of the suggested numbers.")
                print("")
            print("")
            print("1. Flip Horizontally")
            print("2. Mirror Horizontally")
            print("3. Scroll Horizontally")
            print("4. Make Negative")
            print("5. Make Grayscale")
            print("6. Cycle Color Channels")
            print("7. Zoom")
            print("8. Posterize")
            print("9. Change Brightness")
            print("10. Increase Contrast")
            print("11. Blur")
            print("12. Rotate 180 Degrees")
            print("13. Mystery 1")
            print("14. Mystery 2")
            n = eval(input("Enter the number corresponding with the effect you want (or enter 0 to end the program):"))
            canvas.close()
    except FileNotFoundError:
        print("Please enter the location of the file correctly.")
    except NameError:
        print("Please enter a valid number next time.")
    except SyntaxError:
        print("Please enter a valid number next time.")
    except:
        print("Sorry, something unexpected has occured.  Please reload the program.")
开发者ID:Ash927,项目名称:python-labs,代码行数:97,代码来源:imageedit.py


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