473,221 Members | 1,925 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,221 software developers and data experts.

wxPython - py2app setup script for simple app

46
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 3436
bartonc
6,596 Expert 4TB
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
:) 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 Expert 4TB
:) 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 Expert 4TB
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
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
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
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
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
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
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
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
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
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
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
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
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.