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


Python Image.name方法代码示例

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


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

示例1: _addButton

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import name [as 别名]
 def _addButton(self, parent, name, source, size, pos, action_func, on_top=False):
     button = Image(source=source)
     button.size = size
     button.on_top = on_top
     button.pos = pos
     button.scale = 1.
     button.rotation = 0.
     button.action = action_func
     button.name = name
     self.objects.update({name: {'obj': button}})
     parent.add_widget(button)
     
     return button
开发者ID:cassab,项目名称:Decorato_Sketching,代码行数:15,代码来源:collectionviewer.py

示例2: build

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import name [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)
#.........这里部分代码省略.........
开发者ID:arthurfait,项目名称:kivy-chess,代码行数:103,代码来源:main.py


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