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


Python Frame.place_forget方法代码示例

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


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

示例1: UIBelote

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import place_forget [as 别名]
class UIBelote(Notify):
    """
        Initialise the belote widget

    """

    def __init__(self, root, x, y, size_x, size_y):
        Notify.__init__(self)

        # Memorise the frame
        self._root = root 

        self._frame = Frame(width = size_x, height = size_y) 
        # No resize
        self._frame.pack_propagate(0)
        # Style
        self._frame.config(borderwidth = 5)

        self._x = x
        self._y = y

        # Init the buttons
        self._init_button()
        
        self.enable()
        self.clicked = False
     

    def set_position(self, x, y):
        self._x = x
        self._y = y


    def display(self): 
        """
            Display the widget on the table

        """
        self._frame.place(in_ = self._root, x = self._x, y = self._y)


    def hide(self):
        """
            Hide the pannel when the biddings are closed for example

        """
        self._frame.place_forget()


    def _init_button(self):
        """
            TODO

        """
        h = 2
        w = 2
        self._button = Button(self._frame, text="Belote", \
                                height=h, width=w, \
                                command= self._click_belote)
        self._button.pack(fill=X)
        self._button_clicked = False 

    
    def set_button_style(self, clicked):
        """
            TODO
    
        """
        fg = 'white' if clicked else 'black' 
        bg = 'black' if clicked else 'white' 
        self._button.config(foreground= fg, background= bg)


    def _click_belote(self):
        """
            TODO
    
        """
        self.clicked = not self.clicked 


    def disable(self):
        """
            Disable the bid button

        """
        self._button.config(state = DISABLED)


    def enable(self):
        """
            Enable the bid button

        """
        self._button.config(state = NORMAL)

    
    def belote_ack(self):
        """

#.........这里部分代码省略.........
开发者ID:an-o,项目名称:Sub,代码行数:103,代码来源:ui_belote.py

示例2: UIBidding

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import place_forget [as 别名]
class UIBidding(Notify):


    class CoincheException(Exception):
        def __init__(self, pid):
            self.pid = pid


    def __init__(self, root, x, y, size_x, size_y):
        Notify.__init__(self)

        # Memorise the frame
        self._root = root 

        self._frame = Frame(width = size_x, height = size_y) 
        # No resize
        self._frame.pack_propagate(0)
        # Style
        self._frame.config(borderwidth = 5)

        self._x = x
        self._y = y

        # Init the buttons
        self._init_buttons()

        # Will be used to notify the main thread when waiting for a call 
        self.need_bid_event = Event() 
        # Will be used to notify the main thread when waiting for a coinche 
        self.coinche_event = Event() 

        self.pid = 0
        self._last_bid = None 
        
        self.enable()
     
    def display(self): 
        """
            Display the widget on the table

        """
        self._frame.place(in_ = self._root, x = self._x, y = self._y)


    def hide(self):
        """
            Hide the pannel when the biddings are closed for example

        """
        self._frame.place_forget()


    def _init_color_buttons(self):
        """
            Init the buttons to select the color

        """
        # Dedicated frame for buttons
        self._buttons_frame = Frame()
        # This dictionnary will contains all the color buttons
        self._buttons = dict()
        # Several colors are available
        colors = list(Bidding.colors)
        colors.pop()
        # The buttons need to have a fixed size
        h = 2
        w = 2

        for c in colors:
            self._buttons[c] = Button(self._buttons_frame, text=c, \
                                      height=h, width=w, \
                                      command=lambda c=c: self._click_color(c))
            self._buttons[c].pack(side = LEFT)

        # Pack the dedicated frame into the main frame
        self._buttons_frame.pack(in_ = self._frame)

        self._selected_color = None 


    def _init_value_box(self):
        """
            Init the list box which select the value of the bid

        """
        availableValue = Bidding.values 
        # TODO: display "pass" instead of "0"
        #availableValue[0] = "pass"
        self._value_box = Combobox(self._frame, \
                                   values = availableValue, \
                                   # TODO
                                   # Only justify the selected value
                                   #justify = RIGHT, \
                                   state = 'readonly')
        self._value_box.bind("<<ComboboxSelected>>", lambda x: self._update_bid_button())
        self._value_box.set(availableValue[0])
        self._value_box.pack(fill = X)


    @staticmethod
#.........这里部分代码省略.........
开发者ID:an-o,项目名称:Sub,代码行数:103,代码来源:ui_bidding.py


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