mirror of https://github.com/tqdm/tqdm.git
tk & gui: fix `disply()` inheritance
This commit is contained in:
parent
9c219c14b2
commit
99a7c67846
|
@ -113,7 +113,7 @@ class tqdm_gui(std_tqdm): # pragma: no cover
|
||||||
def clear(self, *_, **__):
|
def clear(self, *_, **__):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def display(self):
|
def display(self, *_, **__):
|
||||||
n = self.n
|
n = self.n
|
||||||
cur_t = self._time()
|
cur_t = self._time()
|
||||||
elapsed = cur_t - self.start_t
|
elapsed = cur_t - self.start_t
|
||||||
|
@ -172,7 +172,7 @@ class tqdm_gui(std_tqdm): # pragma: no cover
|
||||||
line2.set_data(t_ago, zdata)
|
line2.set_data(t_ago, zdata)
|
||||||
|
|
||||||
d = self.format_dict
|
d = self.format_dict
|
||||||
d['ncols'] = 0
|
d['ncols'] = 0 # remove bar
|
||||||
ax.set_title(self.format_meter(**d), fontname="DejaVu Sans Mono", fontsize=11)
|
ax.set_title(self.format_meter(**d), fontname="DejaVu Sans Mono", fontsize=11)
|
||||||
self.plt.pause(1e-9)
|
self.plt.pause(1e-9)
|
||||||
|
|
||||||
|
|
13
tqdm/tk.py
13
tqdm/tk.py
|
@ -81,7 +81,7 @@ class tqdm_tk(std_tqdm): # pragma: no cover
|
||||||
else:
|
else:
|
||||||
self._tk_window = tkinter.Toplevel(tk_parent)
|
self._tk_window = tkinter.Toplevel(tk_parent)
|
||||||
|
|
||||||
warn('GUI is experimental/alpha', TqdmExperimentalWarning, stacklevel=2)
|
warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2)
|
||||||
self._tk_dispatching = self._tk_dispatching_helper()
|
self._tk_dispatching = self._tk_dispatching_helper()
|
||||||
|
|
||||||
self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel)
|
self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel)
|
||||||
|
@ -130,21 +130,18 @@ class tqdm_tk(std_tqdm): # pragma: no cover
|
||||||
_close()
|
_close()
|
||||||
elif not self._tk_dispatching:
|
elif not self._tk_dispatching:
|
||||||
if self._warn_leave:
|
if self._warn_leave:
|
||||||
warn('leave flag ignored if not in tkinter mainloop',
|
warn("leave flag ignored if not in tkinter mainloop",
|
||||||
TqdmWarning, stacklevel=2)
|
TqdmWarning, stacklevel=2)
|
||||||
_close()
|
_close()
|
||||||
|
|
||||||
def clear(self, *_, **__):
|
def clear(self, *_, **__):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def display(self):
|
def display(self, *_, **__):
|
||||||
self._tk_n_var.set(self.n)
|
self._tk_n_var.set(self.n)
|
||||||
d = self.format_dict
|
d = self.format_dict
|
||||||
d['ncols'] = None
|
d['ncols'] = 0 # remove bar
|
||||||
text = self.format_meter(**d)
|
self._tk_text_var.set(self.format_meter(**d))
|
||||||
# fixup only default bar format
|
|
||||||
self._tk_text_var.set(
|
|
||||||
text.replace("||", "", 1) if "{l_bar}{r_bar}" in self.bar_format else text)
|
|
||||||
if not self._tk_dispatching:
|
if not self._tk_dispatching:
|
||||||
self._tk_window.update()
|
self._tk_window.update()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue