weather_gui.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Weather-App 作者: Tomasz-Kluczkowski 项目源码 文件源码
def __init__(self, master, controller, tip, cnf, **args):
        """Initialise MyButton.

        Args:
            master (tk.widget): Master widget to which MyButton (slave) 
                instance will belong. The master widget is part of 
                the WeatherApp object.
            controller (Controller): controller object which will store 
                all the data required by each segment of the 
                application.
            tip (str): Tooltip text to display in the status_bar_label.
            cnf (dict): Dictionary with the configuration for MyButton.
            **args: Keyword arguments to further initialise the button.

        :Attributes:
        :system (str): Platform on which application is run.
        :cur_bg (str): Current background color of the button.
        :tip (str): Text to display in the status_bar_label of the app.
        :controller (Controller): controller object which will store all
            the data required by each segment of the application. 
            This has to be the same Controller as for the WeatherApp.
        :v_link (dict): Link to access variables in controller.
        """
        super().__init__(master, cnf, **args)
        self.system = platform.system()
        self.cur_bg = self["bg"]
        self.controller = controller
        self.v_link = self.controller.app_data
        self.tip = tip
        # Action on entering the button with mouse.
        self.bind("<Enter>", lambda e: self.enter_button())
        # Action on leaving the button with mouse.
        self.bind("<Leave>", lambda e: self.leave_button())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号