本文整理汇总了Python中client.ui.controls.Frame.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.__init__方法的具体用法?Python Frame.__init__怎么用?Python Frame.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client.ui.controls.Frame
的用法示例。
在下文中一共展示了Frame.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from client.ui.controls import Frame [as 别名]
# 或者: from client.ui.controls.Frame import __init__ [as 别名]
def __init__(self, parent):
Frame.__init__(
self, x=35, y=20, width=240, height=180,
caption=u'帐号信息', parent=parent,
)
self.textarea = TextArea(
parent=self, x=2, y=10+2, width=240-4, height=180-24-2-10
)
示例2: __init__
# 需要导入模块: from client.ui.controls import Frame [as 别名]
# 或者: from client.ui.controls.Frame import __init__ [as 别名]
def __init__(self, parent):
Frame.__init__(self, x=750, y=20, width=240, height=180, caption=u"花果子念报", parent=parent)
ta = self.textarea = TextArea(parent=self, x=2, y=10 + 2, width=240 - 4, height=180 - 24 - 2 - 10)
ta.text = u"正在获取最新新闻……"
def update(rst):
if rst:
_, content = rst
try:
ta.text = content.decode("utf-8")
return
except Exception as e:
import traceback
traceback.print_exc(e)
ta.text = u"|R无法显示新闻!|r"
from settings import HALL_NOTICE_URL
Executive.call("fetch_resource", update, HALL_NOTICE_URL)
示例3: __init__
# 需要导入模块: from client.ui.controls import Frame [as 别名]
# 或者: from client.ui.controls.Frame import __init__ [as 别名]
def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
self.player = None
self.character = None
self._disabled = False
self._selected = False
self.taganims = []
self.tag_placement = tag_placement
self._color = color
self.bg = None
self._last_balloon = None
Frame.__init__(
self, width=149, height=195,
bot_reserve=20, color=color,
thin_shadow=True,
**kwargs
)
self.x, self.y = x, y
self.charname_lbl = self.add_label(
u'', 7, self.height-30,
width=16, multiline=True,
font_size=9,
anchor_x='left', anchor_y='top',
color=(255, 255, 255, 255),
shadow=(1, 0, 0, 0, 179),
)
from .view import THBattleUI
v = self.parent
while not isinstance(v, THBattleUI):
v = v.parent
self.view = v
self.portcard_area = PortraitCardArea(
parent=self.view,
x=self.x, y=self.y,
width=self.width, height=self.height,
zindex=100,
)
self.equipcard_area = EquipCardArea(
parent=self,
x=3, y=6,
)
w, h = self.width, self.height
self.identity_btn = b = Button(
u'?', parent=self,
x=w-42-4, y=h-24-10-18,
width=42, height=18,
)
self.cur_idtag = 0
@b.event
def on_click():
g = Game.getgame()
tbl = g.ui_meta.identity_table
colortbl = g.ui_meta.identity_color
keys = tbl.keys()
try:
i = (keys.index(self.cur_idtag) + 1) % len(keys)
except ValueError:
i = 0
next = keys[i]
b.caption = tbl[next]
color = getattr(Colors, colortbl[next])
b.color = color
self.set_color(color)
b.update()
self.update()
self.cur_idtag = next
@self.equipcard_area.event
def on_selection_change():
self.view.dispatch_event('on_selection_change')
def tagarrange_bottom():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 1
y -= 27
for a in self.taganims: # they are pyglet.sprite.Sprite instances
x -= 27
a.set_position(x, y)
def tagarrange_me():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 6
y += 142
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
x += 27
def tagarrange_right():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 3
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from client.ui.controls import Frame [as 别名]
# 或者: from client.ui.controls.Frame import __init__ [as 别名]
def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
self.bg = None
self.character = None
self._color = color
self._disabled = False
self._last_balloon = None
self.player = None
self._selected = False
self.taganims = []
self.tag_placement = tag_placement
Frame.__init__(
self, width=149, height=195,
bot_reserve=20, color=color,
thin_shadow=True,
**kwargs
)
self.balloon = BalloonPrompt(self, self.balloon_show)
self.view = view = self.parent
self.x, self.y = x, y
self.charname_lbl = self.add_label(
u'', 7, self.height-30,
width=16, multiline=True,
font_size=9,
anchor_x='left', anchor_y='top',
color=(255, 255, 255, 255),
shadow=(1, 0, 0, 0, 179),
)
self.portcard_area = PortraitCardArea(
parent=view,
x=self.x, y=self.y,
width=self.width, height=self.height,
zindex=100,
)
self.equipcard_area = EquipCardArea(
view=view, parent=self, x=3, y=6,
)
w, h = self.width, self.height
tbl = view.game.ui_meta.identity_table
colortbl = view.game.ui_meta.identity_color
conf = [(tbl[k], getattr(Colors, colortbl[k]), k) for k in tbl]
self.identity_btn = b = OptionButton(
conf=conf, default=0, parent=self,
x=w-42-4, y=h-24-10-18,
width=42, height=18,
)
@b.event
def on_value_changed(v):
self.set_color(b.color)
def tagarrange_bottom():
x, y = self.x, self.y
w = self.width
x += w + 1
y -= 27
for a in self.taganims: # they are pyglet.sprite.Sprite instances
x -= 27
a.set_position(x, y)
def tagarrange_me():
x, y = self.x, self.y
w = self.width
x += w + 6
y += 142
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
x += 27
def tagarrange_right():
x, y = self.x, self.y
w = self.width
x += w + 3
y += 1
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
y += 27
def tagarrange_left():
x, y = self.x, self.y
x -= 28
y += 1
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
y += 27
self._tagarrange_funcs = {
'bottom': tagarrange_bottom,
'me': tagarrange_me,
'left': tagarrange_left,
'right': tagarrange_right,
}
showncard_btn = ImageButton(
#.........这里部分代码省略.........