Hi, new to python and wxpython. I am having alot of fun and learning from this list. All comments welcome. this is a little program that converts ogg theora video to avi. All comments welcome;
#!/usr/bin/python
# Oggtoavi
# Gentoo dependences
# wxpython
# mplayer with "encode USE set"
import os
import sys
import wx
class Oggtoavi(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(360, 370))
panel = wx.Panel(self, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
st1 = wx.StaticText(panel, -1, 'Enter Ogg: ')
st2 = wx.StaticText(panel, -1, 'Enter Avi: ')
self.tc1 = wx.TextCtrl(panel, -1, size=(180, -1))
self.tc2 = wx.TextCtrl(panel, -1, size=(180, -1))
button_send = wx.Button(panel, 1, 'Convert')
hbox1.Add(st1, 0, wx.LEFT, 10)
hbox1.Add(self.tc1, 0, wx.LEFT, 10)
hbox2.Add(st2, 0, wx.LEFT, 10)
hbox2.Add(self.tc2, 0, wx.LEFT, 15)
vbox.Add(hbox1, 0, wx.TOP, 50)
vbox.Add(hbox2, 0, wx.TOP, 50)
vbox.Add(button_send, 0, wx.ALIGN_CENTER | wx.TOP | wx.TOP | wx.BOTTOM, 100)
self.Bind(wx.EVT_BUTTON, self.OnConvert, id=1)
panel.SetSizer(vbox)
self.Centre()
self.ShowModal()
self.Destroy()
def OnConvert(self, event):
ogg = self.tc1.GetValue()
avi = self.tc2.GetValue()
os.system("%s %s %s %s %s %s %s %s" % ('mencoder', ogg, '-ovc', 'lavc', '-oac', 'mp3lame', '-o', avi))
if os.path.exists(avi):
dlg = wx.MessageDialog(self, 'Your avi file was created.', 'Success', wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
sys.exit()
else:
dlg = wx.MessageDialog(self, 'Failed to convert.', 'Error', wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
sys.exit()
app = wx.App()
Oggtoavi(None, -1, 'Oggtoavi')
app.MainLoop()