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


Python Properties.getFontSize方法代码示例

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


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

示例1: main

# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import getFontSize [as 别名]
def main():

    argparser = argparse.ArgumentParser()
    argparser.add_argument('--type', action="store", dest="type")
    argparser.add_argument('-n', action="store", dest="n", type=int)
    argparser.add_argument('--width', action="store", dest="width", type=int)
    argparser.add_argument('--height', action="store", dest="height", type=int)
    argparser.add_argument('--fontsize', action="store", dest="fontsize", type=int)
    argparser.add_argument('-l', action="store", dest="length", type=int)
    options = argparser.parse_args()

    if options.type == None and options.n == None and options.width == None and options.height == None and options.fontsize == None and options.length == None:
        print "No params given, i will use settings.ini"

        props = Properties("settings.ini")
        props.load()
        count = props.getNumber()

        rand_word = RandomWord()
        rand_str = RandomString(int(props.getWordLength()))
        word_type = props.getWordType()

        if word_type == "natural":
            i = 0
            while (i < int(count)):
                i = i+1
                print (rand_word.getFixedLengthWord(int(props.getWordLength())))
                captcha=Captcha(rand_word.getFixedLengthWord(int(props.getWordLength())), int(props.getFontSize()), int(props.getImageWidth()), int(props.getImageHeight()))
                captcha.saveImage()

        elif word_type == "random":
            i = 0
            while (i < int(count)):
                i = i+1
                print (rand_str.shuffle(int(props.getWordLength())))
                captcha=Captcha(rand_str.shuffle(int(props.getWordLength())), int(props.getFontSize()), int(props.getImageWidth()), int(props.getImageHeight()))
                captcha.saveImage()

        else :
            print ("word type must be random or natural")

        print ("Done, generated "+props.getNumber()+" captchas")

    #TODO: сделать возможность часть параматров брать из settings.ini а часть из консоли
    else:

        rand_word = RandomWord()
        rand_str = RandomString(options.length)
        word_type = options.type

        if word_type == "natural":
            i = 0
            while (i < int(count)):
                i = i+1
                print (rand_word.getFixedLengthWord(options.length))
                captcha=Captcha(rand_word.getFixedLengthWord(options.length, options.fontsize, options.width, options.height))
                captcha.saveImage()

        elif word_type == "random":
            i = 0
            while (i < int(count)):
                i = i+1
                print (rand_str.shuffle(options.length))
                captcha=Captcha(rand_str.shuffle(options.length, options.fontsize, options.width, options.height))
                captcha.saveImage()

        else :
            print ("word type must be random or natural")

        print ("Done, generated "+props.getNumber()+" captchas")        
开发者ID:teddypickerfromul,项目名称:py_utils,代码行数:72,代码来源:main.py


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