473,396 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Tkinter vs. py2exe problem

Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Dec 5 '07 #1
5 3410
On Dec 5, 9:50 am, msunde...@gmail.com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Oh yeah... if it matters, I'm using Python 2.5.1 on Win XP, and py2exe
v1.4. I get the same problem using pyinstaller, except it doesn't
show the exception - it just fails to display the buttons.
Dec 5 '07 #2
On Dec 5, 9:50 am, msunde...@gmail.com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Oh, and it fails when the setup() line in setup.py says
"setup(window=['tcgui3.py'])" as well. Same error.
Dec 5 '07 #3
On Dec 5, 9:50 am, msunde...@gmail.com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Nevermind. I fixed it. I had a tkSimpleDialog.py in my local
directory that was typed in from an introductory text.

Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.

Thanks, anyway.
Dec 5 '07 #4
On Dec 5, 10:07 am, msunde...@gmail.com wrote:
On Dec 5, 9:50 am, msunde...@gmail.com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...
I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.
Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:
AttributeError: MyDialog instance has no attribute
'buttonbox'
For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------
from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)
#--------------------------------------------------------------------------------
And my setup.py file looks like this:
#--------------------------------------------------------------------------------
from distutils.core import setup
import py2exe
setup(console=['tcgui3.py'])
#--------------------------------------------------------------------------------
I'm invoking py2exe like this:
C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog
??????

Nevermind. I fixed it. I had a tkSimpleDialog.py in my local
directory that was typed in from an introductory text.

Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.

Thanks, anyway.
Ummm... Un-nevermind. I didn't fix it. It's still complaining.
Dec 5 '07 #5
On Dec 5, 10:46 am, msunde...@gmail.com wrote:
On Dec 5, 10:07 am, msunde...@gmail.com wrote:
On Dec 5, 9:50 am, msunde...@gmail.com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...
I have several dialogs that are derived from the tkSimpleDialog.Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.
Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:
AttributeError: MyDialog instance has no attribute
'buttonbox'
For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------
from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimpleDialog.Dialog)
#--------------------------------------------------------------------------------
And my setup.py file looks like this:
#--------------------------------------------------------------------------------
from distutils.core import setup
import py2exe
setup(console=['tcgui3.py'])
#--------------------------------------------------------------------------------
I'm invoking py2exe like this:
C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog
??????
Nevermind. I fixed it. I had a tkSimpleDialog.py in my local
directory that was typed in from an introductory text.
Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.
Thanks, anyway.

Ummm... Un-nevermind. I didn't fix it. It's still complaining.
Okay, here's a sample program that fails:

#------------------------------------------------------------------
#!/usr/bin/python

from Tkinter import *
import tkSimpleDialog

class MyDialog(tkSimpleDialog.Dialog):
def body(self, master):
Label(master, text="Label").grid()

def apply(self):
print "OK"

if __name__ == "__main__":
root = Tk()
md = MyDialog(root)
mainloop()

#--------------------------------------------

And here's the setup file I'm using with py2exe:

#--------------------------------------------
from distutils.core import setup
import py2exe

opts = {
"py2exe": {
"includes":"tkSimpleDialog"
}
}

setup(windows=['hellogui.py'], options=opts)

#--------------------------------------------

Can't make it any simpler than that... I'm so confused!
Dec 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Anthony Baxter | last post by:
I'm trying to use py2exe and Inno Setup to build an installer for shtoom, which uses tkinter. If I take the py2exe generated directory, and run the executable from there, it works fine. If I...
1
by: | last post by:
I've just started playing with py2exe and tried to create a distribution for a slightly complex Tkinter program that refers to a class in another file. I just try to create an .exe for the main...
0
by: erkidevries | last post by:
Problem compiling Tkinter program with bmp images (using py2exe) I have a Tkinter gui program that uses bmp as backgrounds. The program itself works when I run from the source. I placed the...
0
by: Robin Becker | last post by:
Don't know if this is the right place to ask, but has anyone considered using something like tcl's freewrap code to integrate tkinter into py2xe single executables? We currently use the (fairly...
15
by: flyingisfun1217 | last post by:
Hi, I'm too lazy to retype my "problem", so here's the message I sent to the py2exe mailing list (not quite the right place, but thankfully, I was redirected here...) I know that the most...
1
by: Kevin Walzer | last post by:
I'm not sure how often members of this list visit the Tkinter wiki at http://tkinter.unpythonic.net/wiki/FrontPage; this wiki seems to have less traffic in general than the Tcl/Tk wiki at...
1
by: maryannj | last post by:
I've got a python GUI working with Tkinter, and I need to package it as an executable file, preferably a single file. I've got py2exe working without the 'bundle_files' option, but when I add that...
0
bartonc
by: bartonc | last post by:
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had...
1
by: Alex Bryan | last post by:
I know this is possible so someone out there should be able to help me! Okay, I have a program that uses Tkinter, and BeautifulSoup. I don't think it should be a problem. I want to create an exe of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.