Skip to content

Instantly share code, notes, and snippets.

@daryo918
Created April 29, 2013 22:12
Show Gist options
  • Save daryo918/5485222 to your computer and use it in GitHub Desktop.
Save daryo918/5485222 to your computer and use it in GitHub Desktop.
creador de batch con interfaz wx
#!/usr/bin/python
import wx
class batch(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
self.parent = parent
self.initialize()
def initialize(self):
grilla = grilla = wx.GridBagSizer()
opciones = ["apagar el sistema", "mensajes", "quitar la barra de inicio"]
self.rt = wx.RadioBox(self, label="que batch desea hacer:",choices=opciones,style=wx.RA_SPECIFY_COLS)
self.rt.Bind(wx.EVT_RADIOBOX, self.radiobox)
boton = wx.Button(self,label="crear")
boton.Bind(wx.EVT_BUTTON, self.click)
self.rt.Bind
self.Show(True)
grilla.Add(self.rt,(0,1))
grilla.Add(boton,(0,3))
self.SetSizerAndFit(grilla)
def click(self,event):
try:
self.n
except:
self.n = 0
archivo = open("auto.bat","w")
if self.n == 0:
archivo.write("@echo off\n shutdown -r")
if self.n == 1:
archivo.write("@echo off\n:df\n msg * %random%\ngoto df")
if self.n == 2:
archivo.write("@echo off\n taskkill /f /im explorer.exe")
archivo.close()
wx.MessageBox("archivo creado", 'Info')
def radiobox(self,event):
self.n = event.GetInt()
app = wx.App()
frame = batch (None, -1, "batch creator")
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment