I have a tiny button with a question mark in my app. When clicked, it displays the doc string from a function in my app which helps to explain what the app does.
The problem is, I build a single .exe using pyinstaller and this question mark button does nothing when clicked.
Recreation Steps
- save the file below as run.py
- open command-prompt
- paste
pyinstaller.exe --onefile --windowed run.py
- go to
dist
folder and run single exe - click
?
button and notice it does nothing
run.py below
import tkinter as tk
from tkinter import ttk
''' pyinstaller.exe --onefile --windowed run.py '''
def someotherfunction():
'''
This is some message that I
want to appear but it currently doesn\'t
seem to work
when I put try to launch a messagebox
showinfo window...
'''
pass
def showhelpwindow():
return tk.messagebox.showinfo(title='How to use this tool',
message=someotherfunction.__doc__)
root = tk.Tk()
helpbutton = ttk.Button(root, text='?', command=showhelpwindow, width=2)
helpbutton.grid(row=0, column=3, sticky='e')
root.mainloop()
My setup:
- PyInstaller 3.2
- Windows 7
- Python 3.4.2
I tried adding --noupx
option but that didn't fix it.
EDIT:
I removed --windowed
option this time and the console is now showing me an error when I click this button.
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1533, in __call__
File "run.py", line 156, in showhelpwindow
AttributeError: 'module' object has no attribute 'messagebox'