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


Python Character.set_attribute方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import set_attribute [as 别名]
class Controller:
    """description of class"""

    def __init__(self):
        self.__char = Character()
        # self.__char.setRandomStats()
        self.settings = Settings()
        self.datasets = {}
        self.max_cpoints = 60
        self.max_opoints = 50
        self.money = 2500
        self.datasets["headers"] = []

    def save(self):

        prime_motivation = self.datasets["Prime Motivation: "].var.get()
        most_v_person = self.datasets["Most valued person: "].var.get()
        most_v_pos = self.datasets["Most valued posession: "].var.get()
        valued_people = self.datasets["How do you feel about most people: "].var.get()
        inmode = self.datasets["Inmode:"].var.get()
        exmode = self.datasets["Exmode:"].var.get()

        quirk_value_dictionary = self.datasets["Quirks"].stringvars
        disorder_value_dictionary = self.datasets["Disorders"].stringvars
        phobia_value_dictionary = self.datasets["Phobias"].stringvars
        hair_value_dictionary = self.datasets["Hair"].stringvars
        clothes_value_dictionary = self.datasets["Clothes"].stringvars
        affe_value_dictionary = self.datasets["Affections"].stringvars
        quirk_array = []
        disorder_array = []
        phobia_array = []
        hair_array = []
        clothes_array = []
        affe_array = []
        for key, value in quirk_value_dictionary.items():
            try:
                if value.get() != "off":

                    quirk_array.append(value.get())
            except Exception:
                if value != "off":
                    quirk_array.append(value)

        for key, value in disorder_value_dictionary.items():
            try:
                if value.get() != "off":

                    disorder_array.append(value.get())
            except Exception:
                if value != "off":
                    disorder_array.append(value)

        for key, value in phobia_value_dictionary.items():
            try:
                if value.get() != "off":

                    phobia_array.append(value.get())
            except Exception:
                if value != "off":
                    phobia_array.append(value)

        for key, value in hair_value_dictionary.items():
            try:
                if value.get() != "off":

                    hair_array.append(value.get())
            except Exception:
                if value != "off":
                    hair_array.append(value)

        for key, value in clothes_value_dictionary.items():
            try:
                if value.get() != "off":

                    clothes_array.append(value.get())
            except Exception:
                if value != "off":
                    clothes_array.append(value)

        for key, value in affe_value_dictionary.items():
            try:
                if value.get() != "off":

                    affe_array.append(value.get())
            except Exception:
                if value != "off":
                    affe_array.append(value)

        self.__char.set_attribute("player", self.datasets["player"].get())
        self.__char.set_attribute("First name", self.datasets["first name"].get())
        self.__char.set_attribute("Second name", self.datasets["second name"].get())
        self.__char.set_attribute("Last name", self.datasets["last name"].get())
        self.__char.set_attribute("Alias", self.datasets["alias"].get())
        self.__char.set_attribute("age", self.datasets["age"].get())

        self.__char.set_attribute("family rank", self.datasets["Family rank"].var.get())
        self.__char.set_attribute("parents", self.datasets["Your parents were"].var.get())
        self.__char.set_attribute("parent status", self.datasets["Parent status"].var.get())
        self.__char.set_attribute("parent event", self.datasets["Parent event"].var.get())
        self.__char.set_attribute("family status", self.datasets["Family status"].var.get())
#.........这里部分代码省略.........
开发者ID:Krypticdator,项目名称:First,代码行数:103,代码来源:Controller.py


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