downloader.py 文件源码

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

项目:beepboop 作者: nicolehe 项目源码 文件源码
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号