本文整理汇总了Python中kivy.uix.image.Image.sq_color方法的典型用法代码示例。如果您正苦于以下问题:Python Image.sq_color方法的具体用法?Python Image.sq_color怎么用?Python Image.sq_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.sq_color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import sq_color [as 别名]
def build(self):
self.from_move = None
self.to_move = None
self.chessboard = ChessBoard()
self.analysis_board = ChessBoard()
self.squares = []
self.use_engine = False
self.last_touch_down_move = None
self.last_touch_up_move = None
parent = BoxLayout(size_hint=(1,1))
grid = GridLayout(cols = 8, rows = 8, spacing = 0, size_hint=(1, 1))
for i, name in enumerate(SQUARES):
bt = Image(allow_stretch=True)
bt.sq = i
bt.name = name
# bt.border = [0,0,0,0]
if i in light_squares:
bt.sq_color = "l"
bt.background_down = "img/empty-l.png"
# bt.background_color=[1,1,1,1]
else:
bt.sq_color = "d"
bt.background_down = "img/empty-d.png"
# bt.background_color=[0,0,0,0]
# print i
# bt.bind(on_press=self.callback)
bt.bind(on_touch_down=self.touch_down_move)
bt.bind(on_touch_up=self.touch_up_move)
# bt.bind(on_touch_up=self.touch_move)
grid.add_widget(bt)
self.squares.append(bt)
b = BoxLayout(size_hint=(0.15,0.15))
## Spacers
# b.add_widget(Button(spacing=1))
# b.add_widget(Button(spacing=1))
# b.add_widget(Button(spacing=1))
# Move control buttons
# back_bt = Button(markup=True)
# # back_bt.background_normal="img/empty-l.png"
# back_bt.text="[color=ff3333]Back[/color]"
# back_bt.bind(on_press=self.back)
# b.add_widget(back_bt)
#
save_bt = Button(markup=True)
#fwd_bt.background_normal="img/empty-d.png"
save_bt.text="[color=3333ff]Save[/color]"
# save_bt.text="Save"
save_bt.bind(on_press=self.save)
b.add_widget(save_bt)
# b.add_widget(Button(spacing=10))
# b.add_widget(Button(spacing=10))
# b.add_widget(Button(spacing=10))
# grid.add_widget(b)
# board_box.add_widget(grid)
# board_box.add_widget(b)
# fen_input = TextInput(text="FEN", focus=True, multiline=False)
# def on_fen_input(instance):
# self.chessboard.setFEN(instance.text)
# self.refresh_board()
## print 'The widget', instance.text
#
# fen_input.bind(on_text_validate=on_fen_input)
## self._keyboard.bind(on_key_down=self._on_keyboard_down)
#
#
# b.add_widget(fen_input)
settings_bt = Button(markup=True, text='Setup')
settings_bt.bind(on_press=self.go_to_settings)
b.add_widget(settings_bt)
# self.root.current='settings'
parent.add_widget(grid)
info_grid = GridLayout(cols = 1, rows = 4, spacing = 1, size_hint=(0.3, 1), orientation='vertical')
info_grid.add_widget(b)
self.game_score = ScrollableLabel('New Game', ref_callback=self.go_to_move)
info_grid.add_widget(self.game_score)
self.engine_score = ScrollableLabel('[ref=engine_toggle]Analysis[/ref]', ref_callback=self.add_eng_moves)
#.........这里部分代码省略.........