473,507 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxPython - py2app setup script for simple app

46 New Member
Hey guys

I have just created a gui version of a script with wxpython and it seems to work properly when I run it from a shell.
(All my script does is create a set of folders with a bunch of subfolders)

I then used py2app to try build a standalone/distributable version of it. Once built the app runs and when I hit the "go" button it seems to work.

But it does not create any of the folders.

That is probably a poor explanation of what is going on - hopefully it makes some sense.

Any ideas?

Cheers!

Here is my script that I build with py2app:


Expand|Select|Wrap|Line Numbers
  1.  
  2. #!/usr/bin/python
  3.  
  4. # newjob.py
  5. # version 1.0 June 24 
  6.  
  7. import wx
  8. import os
  9. import sys
  10.  
  11. class MyFrame(wx.Frame):
  12.     def __init__(self, parent, id, title):
  13.         wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(400, 200))
  14.  
  15.         panel = wx.Panel(self, -1)
  16.  
  17.         self.bitmap = wx.Bitmap('/Volumes/HD2/adam/job_structure/gui/newjob/finito.jpg')
  18.         wx.EVT_PAINT(self, self.OnPaint)
  19.  
  20.  
  21.         wxID_ENTERJOBNAME = wx.NewId()
  22.         wxID_JOBNAME = wx.NewId()
  23.         wxID_ENTERSHOTNAME = wx.NewId()
  24.         wxID_shotAmount = wx.NewId()
  25.         wxID_QUITBUTTON = wx.NewId()
  26.         wxID_GOBUTTON = wx.NewId()
  27.  
  28.  
  29.         self.Approot = os.path.dirname(sys.argv[0]) 
  30.  
  31.  
  32.         self.EnterJobname = wx.StaticText(panel, wxID_ENTERJOBNAME, 'Enter a job name:', (10, 20), style=wx.ALIGN_LEFT)
  33.         self.JobName = wx.TextCtrl(panel, wxID_JOBNAME, '', (25,50), (200, -1))
  34.  
  35.         self.EntershotAmount = wx.StaticText(panel, wxID_ENTERSHOTNAME, 'Enter number of shots:', (10, 80), style=wx.ALIGN_LEFT)        
  36.         self.NumberOfShots = wx.TextCtrl(panel, wxID_shotAmount, '', (25,110), (85, -1))
  37.  
  38.         self.QuitButton = wx.Button(panel, wxID_QUITBUTTON, "Quit", (10,145))
  39.         self.QuitButton.Bind(wx.EVT_BUTTON, self.OnClose, id=wxID_QUITBUTTON)
  40.  
  41.         self.GoButton = wx.Button(panel, wxID_GOBUTTON, "GO!!!", (200,145))
  42.         self.GoButton.Bind(wx.EVT_BUTTON, self.OnCreateJob, id=wxID_GOBUTTON)
  43.  
  44.  
  45.     def OnPaint(self, event):
  46.         dc = wx.PaintDC(self)
  47.         dc.DrawBitmap(self.bitmap, 240, 20)
  48.  
  49.  
  50.     def OnClose(self, event):
  51.         self.Close(True)
  52.  
  53.  
  54.     def OnCreateJob(self, event):
  55.  
  56.         jobFolderName = self.JobName.GetValue()
  57.         shotAmount = int( self.NumberOfShots.GetValue())
  58.  
  59.         jobroot = self.Approot
  60.  
  61.         def GLOBALSDIR():
  62.  
  63.             os.mkdir( "global")
  64.  
  65.             os.mkdir( "global/2d")
  66.             os.mkdir( "global/2d/ae")
  67.             os.mkdir( "global/2d/ae/render")
  68.             os.mkdir( "global/2d/ae/script")
  69.             os.mkdir( "global/2d/ai")
  70.             os.mkdir( "global/2d/ai/project")    
  71.             os.mkdir( "global/2d/ai/export")
  72.             os.mkdir( "global/2d/motion")
  73.             os.mkdir( "global/2d/motion/scripts")
  74.             os.mkdir( "global/2d/motion/render")
  75.             os.mkdir( "global/2d/psd")
  76.             os.mkdir( "global/2d/psd/project")
  77.             os.mkdir( "global/2d/psd/export")
  78.             os.mkdir( "global/2d/shk")
  79.             os.mkdir( "global/2d/shk/script")
  80.             os.mkdir( "global/2d/shk/render")
  81.             os.mkdir( "global/2d/output")
  82.  
  83.             os.mkdir( "global/3d")
  84.             os.mkdir( "global/3d/boujou")
  85.             os.mkdir( "global/3d/maya")
  86.             os.mkdir( "global/3d/max")
  87.             os.mkdir( "global/3d/syntheyes")
  88.             os.mkdir( "global/3d/output")
  89.  
  90.             os.mkdir( "global/color")
  91.  
  92.             os.mkdir( "global/output")
  93.             os.mkdir( "global/output/dvd")
  94.             os.mkdir( "global/output/dvd/projects")
  95.             os.mkdir( "global/output/dvd/builds")
  96.             os.mkdir( "global/output/quicktime")
  97.  
  98.             os.mkdir( "global/edit")
  99.             os.mkdir( "global/edit/audio")
  100.             os.mkdir( "global/edit/fcp")
  101.             os.mkdir( "global/edit/fcp/projects")
  102.             os.mkdir( "global/edit/graphics")
  103.             os.mkdir( "global/edit/edl")
  104.             os.mkdir( "global/edit/xml")
  105.  
  106.             os.mkdir( "global/plates")
  107.             os.mkdir( "global/ref")
  108.  
  109.  
  110.         def SUBFOLDERS():
  111.  
  112.             os.mkdir( "2d")
  113.             os.mkdir( "2d/ae")
  114.             os.mkdir( "2d/ae/render")
  115.             os.mkdir( "2d/ae/script")
  116.             os.mkdir( "2d/ai")
  117.             os.mkdir( "2d/ai/project")    
  118.             os.mkdir( "2d/ai/export")
  119.             os.mkdir( "2d/motion")
  120.             os.mkdir( "2d/motion/scripts")
  121.             os.mkdir( "2d/motion/render")
  122.             os.mkdir( "2d/psd")
  123.             os.mkdir( "2d/psd/project")
  124.             os.mkdir( "2d/psd/export")
  125.             os.mkdir( "2d/shk")
  126.             os.mkdir( "2d/shk/render")
  127.             os.mkdir( "2d/shk/script")
  128.             os.mkdir( "2d/output")
  129.  
  130.             os.mkdir( "3d")
  131.             os.mkdir( "3d/boujou")
  132.             os.mkdir( "3d/maya")
  133.             os.mkdir( "3d/max")
  134.             os.mkdir( "3d/syntheyes")
  135.             os.mkdir( "3d/output")
  136.  
  137.             os.mkdir( "plates")
  138.  
  139.             os.chdir( "../")
  140.  
  141.  
  142.         #CREATE JOB DIRECTORY
  143.         os.mkdir( jobFolderName)
  144.  
  145.         #CREATE OFFLINE & CHANGE INTO OFFLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES & GLOBALS
  146.         os.mkdir( jobFolderName + "/offline")
  147.         os.chdir( jobFolderName + "/offline")
  148.         GLOBALSDIR()
  149.  
  150.         #CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
  151.  
  152.         for i in range(1, shotAmount + 1):
  153.             shotname = '%03d' % (i)
  154.             os.mkdir( shotname)
  155.             os.chdir( shotname)
  156.             SUBFOLDERS()
  157.  
  158.         #GO BACK ONE DIRECTORY INTO THE JOB FOLDER
  159.  
  160.         os.chdir( "../")
  161.  
  162.         #CREATE ONLINE & CHANGE INTO ONLINE DIRECTORY TO CREATE GLOBAL DIRECTORY
  163.  
  164.         os.mkdir( "online")
  165.         os.chdir( "online")
  166.  
  167.         GLOBALSDIR()
  168.  
  169.         #CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
  170.  
  171.         for i in range(1, shotAmount + 1):
  172.             shotname = '%03d' % (i)
  173.             os.mkdir( shotname)
  174.             os.chdir( shotname)
  175.             SUBFOLDERS()
  176.  
  177.         dlg = wx.MessageDialog(self, 'Sweet! ', 'The job directory "' + jobFolderName + '" has been created', wx.OK|wx.ICON_INFORMATION)
  178.         dlg.ShowModal()
  179.         dlg.Destroy()
  180.  
  181.         self.Close(True)
  182.  
  183.  
  184. class MyApp(wx.App):
  185.     def OnInit(self):
  186.         frame = MyFrame(None, -1, 'Finito Films - Create New Job')
  187.         frame.Show(True)
  188.         frame.Centre()
  189.         return True
  190.  
  191. app = MyApp(0)
  192. app.MainLoop()
  193.  
  194.  
Jun 25 '07 #1
5 3445
bartonc
6,596 Recognized Expert Expert
Of course, The wxPython part looks fine.
Someone with Mac experience would be interested in the setup script contents.
I went to the py2app site; it's even more cryptic than the py2exe info that I've been able to gather. I'll include the link anyway: py2applet .
I don't know if a py2exe script example will be much help (finding out if p2e uses setuptools would answer some of that). There are p2e examples in the Articles section of this group.

Sorry to not be of more help.
Jun 25 '07 #2
ateale
46 New Member
:) Thanks for looking!
I haven't had any luck resolving the problem yet.

Can you recommend any other ways to create standalone python apps?

Thanks a lot!



Of course, The wxPython part looks fine.
Someone with Mac experience would be interested in the setup script contents.
I went to the py2app site; it's even more cryptic than the py2exe info that I've been able to gather. I'll include the link anyway: py2applet .
I don't know if a py2exe script example will be much help (finding out if p2e uses setuptools would answer some of that). There are p2e examples in the Articles section of this group.

Sorry to not be of more help.
Jun 25 '07 #3
bartonc
6,596 Recognized Expert Expert
:) Thanks for looking!
I haven't had any luck resolving the problem yet.

Can you recommend any other ways to create standalone python apps?

Thanks a lot!
This is old, but looks interesting. It seems that you may have an example setup script in the distro somewhere.
Jun 25 '07 #4
bartonc
6,596 Recognized Expert Expert
This is old, but looks interesting. It seems that you may have an example setup script in the distro somewhere.
Here is a current link.
Jun 25 '07 #5
ateale
46 New Member
thanks, that's what I had been working from to get py2app going - but I can't find anything in there to answer why my app doesn't "do its thing"

Thanks for looking around!
Jun 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1988
by: Austin | last post by:
""" Minimal setup.py example, run with: % python setup.py py2app """ from distutils.core import setup import py2app setup( app = , )
1
2548
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have...
0
1446
by: Bob Swerdlow | last post by:
I'm trying to move my application from bundlebuilder to py2app. I upgraded to PyObjC 1.2, which include py2app 1.7, but I got the following error. I saw a note on the py2app site that earlier...
0
2005
by: Richard Taylor | last post by:
User-Agent: OSXnews 2.07 Xref: number1.nntp.dca.giganews.com comp.lang.python:437315 Hi I am trying to use py2app (http://undefined.org/python/) to package a gnome-python application...
0
1544
by: Durumdara | last post by:
Hi ! I have an application that I compile to exe. 1.) I want to compile main.ico into exe, or int zip. Can I do it ? 2.) Can I compile the result to my specified directory, not into the...
6
4752
by: zdp | last post by:
Dear all: I made a window program by wxPython. Split windows, treectrl, listctrl and textctrl are used. When I program in python, the look & feel of the window controls are like the windos XP...
2
2304
by: James Stroud | last post by:
Hello All, I am trying to create a semi-standalone with the vendor python on OS X 10.4 (python 2.3.5). I tried to include some packages with both --packages from the command and the 'packages'...
0
13435
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...
3
3425
by: AdamGr | last post by:
I am currently trying to convert a program I just wrote to application form, on the Mac. I'm using py2app to accomplish this, and everything works fine up until the last stage; when I try to complete...
0
1796
by: Stef Mientki | last post by:
Peter Anderson wrote: In PyScripter, you should run wxPython in the plain remote machine (not the wxPython remote), and you should set "reset before run flag" or reset the remote machine each...
0
7223
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
7111
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
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.