def refresh_click(root, is_inbox, load, inbox, sent): single = thread_single.Singleton() if is_inbox: single.thr = threading.Thread(target=load, args=(root, inbox)) else: single.thr = threading.Thread(target=load, args=(root, sent)) single.start()
def show(root: Tk, elems, load, logic): try: frame = ttk.Frame(root) global image_set if not image_set: global image image = ImageTk.PhotoImage(Image.open("imgs/wifi.png")) image_set = True label = ttk.Label(frame, text='wifi_image') label['image'] = image label2 = ttk.Label(frame, text='Что-то не так с интернет-соединением') single = thread_single.Singleton() single.thr = threading.Thread(target=load, args=(root, logic)) btn = ttk.Button(frame, text='Побробовать ещё', command=lambda: single.start()) elems.append(frame) # elems.append(label) # elems.append(label2) # elems.append(btn) frame.grid() label.grid() label2.grid() btn.grid(pady=20) except RuntimeError: print('>Trying to paint error screen after closing window')
def change_box(root, listbox, is_inbox, load, inbox, sent): a = listbox.curselection() if len(a) == 0: return if {0: True, 1: False}.get(a[0], is_inbox) == is_inbox: return single = thread_single.Singleton() if is_inbox: single.thr = threading.Thread(target=load, args=(root, sent)) else: single.thr = threading.Thread(target=load, args=(root, inbox)) single.start()
def label_click(root, is_inbox, load, inbox, sent, e, page, pages): single = thread_single.Singleton() p = e.widget.cget('text') p = { '<<': 1, '<': page - 10, '>': page + 10, '>>': pages }.get(p, safe_cast(p)) if p < 1: p = 1 if p > pages: p = pages if is_inbox: single.thr = threading.Thread(target=load, args=(root, inbox, p)) else: single.thr = threading.Thread(target=load, args=(root, sent, p)) single.start()
if driver.get_log('driver')[-1]['message'] == DISCONNECTED_MSG: driver = webdriver.Chrome( 'chromedriver_win32/chromedriver.exe') driver_is_active = True except: pass else: driver = webdriver.Chrome('chromedriver_win32/chromedriver.exe') driver_is_active = True driver.get(url) if __name__ == '__main__': r = Tk() single = thread_single.Singleton() single.thr = threading.Thread(target=settings, args=(r, )) single.start() mainlooped = True r.mainloop() mainlooped = False if single.thr.is_alive(): single.thr.join() if driver is not None: driver.quit() read_mails.logout()
def mail_open(lmbd): single = thread_single.Singleton() single.thr = threading.Thread(target=lmbd) single.start()
def write_click(root, load, send): single = thread_single.Singleton() single.thr = threading.Thread(target=load, args=(root, send)) single.start()
def change_screen(root: Tk, load, sent): single = thread_single.Singleton() single.thr = threading.Thread(target=load, args=(root, sent)) single.start()