I'm currently working on a program that accepts a specific file as input, works on the data and provides two graphs through Matplotlib (the only module imported in the data parsing file).
For this I have made a small GUI for the user to choose the file to have a graph made of. (w/ tkinter and PIL imported).
I have to make an app out of this and I'm using PyInstaller to it. Unfortunately I haven't been able to make the final file work (or run properly).
I have already made several modifications either to the code itself, but also to the PyInstaller's .spec file.
I have added the function to fix the path for PyInstaller. I have modified the .spec file to add the path to an image, not to show the console. I have tried with these settings both on/off: UPX, One File. I have checked the log files for missing modules as everything seems to be ok.
Some of the code:
Imports on the GUI file:
import sys
import os
import tkinter as tk
from tkinter.filedialog import askopenfilename
from tkinter.messagebox import showerror
from PIL import ImageTk, Image
import rectifierDataParser
Imports on the Data Parsing file:
import sys
import os
import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
GUI File:
class Application(tk.Frame):
def __init__(self, master = None):
tk.Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.fileButton = tk.Button(self, text(...))
self.quitButton = tk.Button(self, text(...))
self.fileButton.pack(side = 'top')
self.quitButton.pack(side = 'bottom')
def load_file(self):
filename = askopenfilename(title = "Select file", filetypes = [("Files", ("*.001", (...)))]
rectifierDataParser.main(filename)
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
app = Application()
app.master.title('Graphing Data')
app.master.geometry('300x200')
img = ImageTk.PhotoImage(Image.open("logo.jpg"))
panel = tk.Label(app, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
app.mainloop()
As I'm currently not able to see the GUI on the screen, is there any problem with the code itself or any compatibility with PyInstaller (supposedly PyInstaller is fully functional w/Tkinter).
I hope one of you might help me have a breakthrough as I have been stuck on this for way to much time! Many thanks in advance!