52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
from ..VDM import VDM
|
|
import tkinter as tk
|
|
import i3
|
|
from tkinter import ttk
|
|
import os
|
|
|
|
class tkinter:
|
|
def __init__(self):
|
|
""" init vdm object and create GUI """
|
|
self.v = VDM()
|
|
self.indice = 0
|
|
self.vdm = self.v.get()
|
|
|
|
self.root = tk.Tk()
|
|
self.gui(self.root)
|
|
|
|
def nextAction(self, event=None):
|
|
if self.indice == len(self.vdm)-1:
|
|
self.vdm = self.v.get()
|
|
self.indice = 0
|
|
else:
|
|
self.indice+=1
|
|
self.render()
|
|
|
|
def prevAction(self, event=None):
|
|
if self.indice > 0:
|
|
self.indice-=1
|
|
self.render()
|
|
|
|
def gui(self, master):
|
|
self.mainwindow = ttk.Frame(master)
|
|
self.message = tk.Message(master, text="No VDM load for the moment", width="400")
|
|
|
|
self.next = ttk.Button(master, text=">>", command=self.nextAction)
|
|
self.prev = ttk.Button(master, text="<<", command=self.prevAction)
|
|
self.root.bind('<Left>', self.prevAction)
|
|
self.root.bind('<Right>', self.nextAction)
|
|
|
|
self.message.pack(fill="y", side="left", padx="5", pady="5")
|
|
self.prev.pack(fill="y", side="left", pady="1")
|
|
self.next.pack(fill="y", side="right", pady="1")
|
|
|
|
def _floatingDisabler(self):
|
|
i3.msg("command", "floating enable")
|
|
|
|
def render(self):
|
|
print("indice {}".format(self.indice))
|
|
|
|
self.message.configure(text=self.vdm[self.indice])
|
|
self.root.after(1, self._floatingDisabler)
|
|
self.root.mainloop()
|