You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python_exp/level.py

63 lines
1.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Ui_PYdesign
from abc import ABC, abstractmethod
# from PYdesign import MainWindow
from global_var import get_value
class parent():
ImagePath = ""
# 由各个子类调用传入参数为等级ui界面额外信息
def __init__(self, level, ui=get_value('ui'), extext='', ):
text = '创建了一个等级 {} 的实例!'.format(level)
print(text + extext)
ui.showTXT(text + extext)
# 等级ui
def __del__(self, level, ui=get_value('ui')):
text = '一个等级为 {} 的实例被删除惹'.format(level)
print(text)
ui.showTXT(text)
def setImagePath(self, path):
ImagePath = path
class level0(parent):
# 等级0的创建函数
def __init__(self):
super(level0, self).__init__(0, get_value('ui'), ' 千里之行始于足下,让我们从0开始吧!')
self.ImagePath = 'image/Carrot0.jpg'
# 等级0的删除函数
def __del__(self):
super().__del__(0, get_value('ui'))
class level1(parent):
# 等级1的创建函数
def __init__(self):
super().__init__(1, ui=get_value('ui'))
self.ImagePath = 'image/Carrot1.png'
def __del__(self):
super().__del__(1, ui=get_value('ui'))
class level2(parent):
def __init__(self):
super().__init__(2, ui=get_value('ui'))
self.ImagePath = 'image/Carrot2.png'
def __del__(self):
super().__del__(2, ui=get_value('ui'))
class level3(parent):
def __init__(self):
super().__init__(3, ui=get_value('ui'), extext='这是最高等级了!恭喜!')
self.ImagePath = 'image/Carrot3.jpg'
def __del__(self):
super().__del__(3, ui=get_value('ui'))