Foros del Web » Programando para Internet » Python »

hacer .exe a los archivos .py

Estas en el tema de hacer .exe a los archivos .py en el foro de Python en Foros del Web. como hago los archivos .py a exe?...
  #1 (permalink)  
Antiguo 09/10/2008, 17:38
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 15 años, 11 meses
Puntos: 1
hacer .exe a los archivos .py

como hago los archivos .py a exe?
  #2 (permalink)  
Antiguo 09/10/2008, 19:18
AlvaroG
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: hacer .exe a los archivos .py

buscando encontré esto, creo que es suficiente
http://mundogeek.net/archivos/2008/0...ciones-python/
http://www.py2exe.org/


Saludos.
  #3 (permalink)  
Antiguo 10/10/2008, 06:48
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: hacer .exe a los archivos .py

Jeje, ¿para qué te fuiste tan lejos alvlin? .

Aquí lo tenemos:
http://www.forosdelweb.com/f130/faqs...3/#post2533652
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #4 (permalink)  
Antiguo 10/10/2008, 15:16
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 15 años, 11 meses
Puntos: 1
Respuesta: hacer .exe a los archivos .py

no funciona mi codigo

Código python:
Ver original
  1. import wx
  2.  
  3. class SketchWindow(wx.Window):
  4.     def __init__(self, parent, ID):
  5.         wx.Window.__init__(self, parent, ID)
  6.  
  7.        
  8.        
  9.         self.SetBackgroundColour("blue")
  10.         self.color = "white"
  11.         self.thickness = 1
  12.         self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
  13.         self.lines = []
  14.         self.curLine = []
  15.         self.pos = (0, 0)
  16.         self.InitBuffer()
  17.         self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
  18.         self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
  19.         self.Bind(wx.EVT_MOTION, self.OnMotion)
  20.         self.Bind(wx.EVT_SIZE, self.OnSize)
  21.         self.Bind(wx.EVT_IDLE, self.OnIdle)
  22.         self.Bind(wx.EVT_PAINT, self.OnPaint)
  23.  
  24.  
  25.     def InitBuffer(self):
  26.         size = self.GetClientSize()
  27.         self.buffer = wx.EmptyBitmap(size.width, size.height)
  28.         dc = wx.BufferedDC(None, self.buffer)
  29.         dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
  30.         dc.Clear()
  31.         self.DrawLines(dc)
  32.         self.reInitBuffer = False
  33.  
  34.     def GetLinesData(self):
  35.         return self.lines[:]
  36.  
  37.     def SetLinesData(self, lines):
  38.         self.lines = lines[:]
  39.         self.InitBuffer()
  40.         self.Refresh()
  41.  
  42.     def OnLeftDown(self, event):
  43.         self.curLine = []
  44.         self.pos = event.GetPositionTuple()
  45.         self.CaptureMouse()
  46.  
  47.     def OnLeftUp(self, event):
  48.         if self.HasCapture():
  49.             self.lines.append((self.color, self.thickness, self.curLine))
  50.             self.curLine = []
  51.             self.ReleaseMouse()
  52.  
  53.     def OnMotion(self, event):
  54.         if event.Dragging() and event.LeftIsDown():
  55.             dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
  56.             self.drawMotion(dc, event)
  57.             event.Skip()
  58.  
  59.     def drawMotion(self, dc, event):
  60.         dc.SetPen(self.pen)
  61.         newPos = event.GetPositionTuple()
  62.         coords = self.pos + newPos
  63.         self.curLine.append(coords)
  64.         dc.DrawLine(*coords)
  65.         self.pos = newPos
  66.  
  67.     def OnSize(self, event):
  68.         self.reInitBuffer = True
  69.  
  70.     def OnIdle(self, event):
  71.         if self.reInitBuffer:
  72.             self.InitBuffer()
  73.             self.Refresh(False)
  74.  
  75.     def OnPaint(self, event):
  76.         dc = wx.BufferedPaintDC(self, self.buffer)
  77.  
  78.     def DrawLines(self, dc):
  79.         for colour, thickness, line in self.lines:
  80.             pen = wx.Pen(colour, thickness, wx.SOLID)
  81.             dc.SetPen(pen)
  82.             for coords in line:
  83.                 dc.DrawLine(*coords)
  84.  
  85.     def SetColor(self, color):
  86.         self.color = color
  87.         self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
  88.  
  89.     def SetThickness(self, num):
  90.         self.thickness = num
  91.         self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
  92.  
  93.  
  94. class SketchFrame(wx.Frame):
  95.     def __init__(self, parent, id, title):
  96.         wx.Frame.__init__(self, parent, id, size=(800,600))
  97.         self.sketch = SketchWindow(self, -1)
  98.         menubar = wx.MenuBar()
  99.         file = wx.Menu()
  100.         file.Append(file, '&File')
  101.         self.SetMenuBar(menubar)
  102.  
  103.         self.Show(True)
  104.  
  105. app = wx.App()
  106. SketchFrame(None, -1, "Sketch Frame",)
  107. app.MainLoop()

Última edición por iozk; 10/10/2008 a las 15:29 Razón: highlight
  #5 (permalink)  
Antiguo 10/10/2008, 15:23
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: hacer .exe a los archivos .py

¿Qué es lo que no funciona? ¿Da algún error?. Además, te agradecería que usaras la etiqueta [highlight=python] y [/ highlight] para poner el código, así no se pierde el indentado y se vuelve más fácil de leer.
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #6 (permalink)  
Antiguo 10/10/2008, 15:30
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 15 años, 11 meses
Puntos: 1
Respuesta: hacer .exe a los archivos .py

Traceback (most recent call last):
File "C:\pnt.py", line 106, in ?
SketchFrame(None, -1, "Sketch Frame",)
File "C:\pnt.py", line 96, in __init__
wx.Frame.__init__(self, parent, id, size=(800,600))
File "C:\Python24\lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py", line 484, in __init__
newobj = _windows_.new_Frame(*args, **kwargs)
PyNoAppError: The wx.App object must be created first!
>>>
  #7 (permalink)  
Antiguo 08/01/2010, 09:45
 
Fecha de Ingreso: febrero-2007
Mensajes: 2
Antigüedad: 17 años, 2 meses
Puntos: 0
Respuesta: hacer .exe a los archivos .py

Cita:
Iniciado por iozk Ver Mensaje
Traceback (most recent call last):
File "C:\pnt.py", line 106, in ?
SketchFrame(None, -1, "Sketch Frame",)
File "C:\pnt.py", line 96, in __init__
wx.Frame.__init__(self, parent, id, size=(800,600))
File "C:\Python24\lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py", line 484, in __init__
newobj = _windows_.new_Frame(*args, **kwargs)
PyNoAppError: The wx.App object must be created first!
>>>
No se si lo has solucionado pero tienes que cambiar un par de lineas
primero en la linea 105
app = wx.App(False)
y en las lines 99 y 100 hay que agregar self.
final mente en la 100
self.file.Append(2, '&File')

con todo esto queda solucionado.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:49.