Python Forum
[Tkinter] How to make pyinstaller import the ttk theme?
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to make pyinstaller import the ttk theme?
#1
I have a project done and it is in the following:
import tkinter as tk
from tkinter import ttk
import tkinter.messagebox as tmb
from ttkthemes import ThemedStyle

class UI(ttk.Frame):
    def __init__(self, parent=None):
        super(UI,  self).__init__(parent)
        self.parent = parent
        style = ThemedStyle(parent)
        style.set_theme("arc")
        self.parent.geometry("480x520")
        self.init_ui()

    def init_ui(self):
        self.parent.title("New window")
        self.entrada = ttk.Entry(self, text="insert")
        self.entrada.grid(row=2, column=2) 
        boton = ttk.Button(self, text="puls", command=self.ver)
        boton.grid(row=2, column=3)
        self.pack()

    def ver(self):
        try:
            res = int(self.entrada.get())
            print(res)
        except ValueError:
            tmb.showwarning(title = "error", message = " error")

if __name__== '__main__':
    root = tk.Tk() 
    sug = tk.Label(root, text="example missing")
    sug.pack()
    app = UI(parent=root)
    app.mainloop()
When I use pyinstaller to create an exe, it releases the error that the exported exe program can not be executed: below I leave it as I use it, it should be noted that I have used a thema for the program and I doubt that it is imported.
pyinstaller --windowed ui.py -i icono.ico --onefile
obtain
---------------
error

Fatal Error! Failed to execute script ui
[Image: FyqBt.png]
[Image: EIj2t.png]
[Image: bx5Ci.png]
Reply


Messages In This Thread
How to make pyinstaller import the ttk theme? - by royer14 - Nov-20-2017, 02:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Theme does not change globally TheTechRobo 2 3,421 Apr-21-2020, 04:00 PM
Last Post: deanhystad
  How can I get Colors of current GTK theme? ondoho 2 6,432 May-26-2017, 03:32 PM
Last Post: ondoho

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020