--- a/scripts/viewer/dlb_cpu_usage.in +++ b/scripts/viewer/dlb_cpu_usage.in @@ -1,8 +1,8 @@ #!/usr/bin/env python2 -import Tkinter as tk -import ttk -import tkMessageBox +import tkinter as tk +from tkinter import ttk +from tkinter import messagebox import random import sys @@ -46,7 +46,7 @@ def start(self): if self.viewer.empty(): - tkMessageBox.showinfo("Warning", "Add some process before starting") + messagebox.showinfo("Warning", "Add some process before starting") if self.viewer: self.viewer.start() --- a/scripts/viewer/dlb_viewer.py.in +++ b/scripts/viewer/dlb_viewer.py.in @@ -3,11 +3,12 @@ import time from collections import deque # GUI -import Tkinter as tk -import ttk +import tkinter as tk +from tkinter import ttk import progressmeter from matplotlib.figure import Figure, figaspect -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg +from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT #DLB import dlb_wrapper @@ -39,7 +40,7 @@ self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1) if self.debug: - self.toolbar = NavigationToolbar2TkAgg(self.canvas, self ) + self.toolbar = NavigationToolbar2QT(self.canvas, self ) self.toolbar.pack() self.toolbar.update() --- a/scripts/viewer/progressmeter.py +++ b/scripts/viewer/progressmeter.py @@ -1,10 +1,10 @@ #!/usr/bin/env python2 '''Michael Lange -The Meter class provides a simple progress bar widget for Tkinter. +The Meter class provides a simple progress bar widget for tkinter. INITIALIZATION OPTIONS: -The widget accepts all options of a Tkinter.Frame plus the following: +The widget accepts all options of a tkinter.Frame plus the following: fillcolor -- the color that is used to indicate the progress of the corresponding process; default is "orchid1". @@ -18,22 +18,22 @@ textcolor -- the color to use for the widget's text; default is "black". WIDGET METHODS: -All methods of a Tkinter.Frame can be used; additionally there are two widget specific methods: +All methods of a tkinter.Frame can be used; additionally there are two widget specific methods: get() -- returns a tuple of the form (value, text) set(value, text) -- updates the widget's value and the displayed text; if value is omitted it defaults to 0.0 , text defaults to None . ''' -import Tkinter +import tkinter -class Meter(Tkinter.Frame): +class Meter(tkinter.Frame): def __init__(self, master, width=300, height=20, bg='white', fillcolor='orchid1',\ value=0.0, text=None, font=None, textcolor='black', *args, **kw): - Tkinter.Frame.__init__(self, master, bg=bg, width=width, height=height, *args, **kw) + tkinter.Frame.__init__(self, master, bg=bg, width=width, height=height, *args, **kw) self._value = value - self._canv = Tkinter.Canvas(self, bg=self['bg'], width=self['width'], height=self['height'],\ + self._canv = tkinter.Canvas(self, bg=self['bg'], width=self['width'], height=self['height'],\ highlightthickness=0, relief='flat', bd=0) self._canv.pack(fill='both', expand=1) self._rect = self._canv.create_rectangle(0, 0, 0, self._canv.winfo_reqheight(), fill=fillcolor,\ @@ -84,7 +84,7 @@ meter.set(value, 'Demo successfully finished') if __name__ == '__main__': - root = Tkinter.Tk(className='meter demo') + root = tkinter.Tk(className='meter demo') m = Meter(root, relief='ridge', bd=3) m.pack(fill='x') m.set(0.0, 'Starting demo...')