Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyCommand
#1
Well this is just a little program i whipped up. Really I am just testing out the text widget in Tkinter so I decided to make this:
Code:
from Tkinter import *
import os

class Commandx(Frame):
    def __init__(self):
        global cmd, result
        top = Tk()
        top.title('pyCommand v1.0')
        Frame.__init__(self)
        result = Text(self, bg='#000000', fg='#0AC92B')
        result.pack(side=BOTTOM)
        go = Button(self, text='Execute', command=self.onclick).pack(side=RIGHT)
        c = Button(self, text='Clear', command=self.clear).pack(side=RIGHT)
        Label(self, text='Please enter your command:').pack(side=LEFT)
        cmd = Entry(self)
        cmd.pack()

    def onclick(self):
        global cmd, result
        command = cmd.get()
        status = os.popen(command).read()
        if status == '':
            result.delete(END)
            result.insert(INSERT, 'You have entered an incorrect system command, try "help"')
        else:
            result.delete(END)
            result.insert(INSERT, status)

    def clear(self):
        global cmd, result
        cmd.delete(0, END)
        result.delete(1.0, END)
        
    
if __name__ == '__main__' :
    window = Commandx()
    window.pack()
    window.mainloop()

Basically you just type a system command and it executes it, clear button is self explanatory. I realize this is impractical and you could simply use a terminal I was just testing out some cool feature's like awesome green text on a black background Smile. I may add more features to make it practical or a may even make a text editor! Blackhat
[Image: izsyo6.jpg]


Reply
#2
It'd be nice if you could post some print screens of the program.
Reply
#3
Sure,
Although I am running it on linux it will work on all platforms.
[Image: izsyo6.jpg]


Reply
#4
I've always been interested in learning how to use Tkinter... I guess I need to study the module. Smile
Do what thou wilt shall be the whole of the Law. Love is the law, love under will.
.::The Rights of Man::.
Reply
#5
(02-28-2010, 10:16 AM)Μαύρο Wrote: I've always been interested in learning how to use Tkinter... I guess I need to study the module. Smile

I would personally suggest wxpython, also uber1337 I would reccomend popen'ing in a seperate thread.
[Image: nv70ad.png]
Terrorcore, unleash, extermination
Hyper real, cold blood, determination
fudge them, I like this sensation
Incredible, I from the annihilation
Reply
#6
Looks really good. It inspires me to learn more python.
Reply
#7
nice share dude! thanks Smile
Reply
#8
(04-05-2010, 06:19 PM)Fallen Wrote: I would personally suggest wxpython, also uber1337 I would reccomend popen'ing in a seperate thread.
Hah yeah I was unfamiliar with threads when I wrote this, idk why all my old threads keep bumping xD
[Image: izsyo6.jpg]


Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)