[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] python help



Chuck,

What you have will work just fine. The only problem is that you imported everything from the os module directly into the namespace, but then tried to call os.system("echo done"). Using that sort of import you should just use system() (no "os.").

Either do:

import os
....
os.system("echo done")

*OR*

from os import *
...
system("echo done")

Hope this helps,

Vern

--
This time for sure!
   -Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
vceder canterburyschool org; 260-436-0746; FAX: 260-436-5137

cliebow downeast net wrote:
any snakers out there willing to teach  a little python? simply need to
execute a command by pushing a button..using os.system..brain is fried from
googling this..chuck

#!/usr/bin/python #import os, Tkinter
#import string from Tkinter import *
from os import *
#from sys import *
#dir(os)


class Application(Frame): def __init__(self, master=None):
Frame.__init__(self, master) self.grid() self.createWidgets()
self.createWidgets2()
self.createWidgets3()
self.createWidgets4()


def createWidgets(self):
self.quitButton = Button ( self, text="Install RPMS", fg="white",
command=self.wooha) self.quitButton.grid()


def createWidgets2(self):
self.quitButton = Button ( self, text="Add an entire new ldap directory",
fg="red" , command=self.wooha2)
self.quitButton.grid()


def createWidgets3(self):
self.quitButton = Button ( self, text="Install from csvfiles", fg="blue" , command=self.wooha3)
self.quitButton.grid()


def createWidgets4(self):
self.quitButton = Button ( self, text="Install Single User", fg="green" , command=self.wooha4)
self.quitButton.grid()


def wooha(self):
#cmd="/usr/bin/freecell"
os.system("echo done")
#print "Hey"


    def wooha2(self):
 print "Ho"

    def wooha3(self):
 print "Hee"

    def wooha4(self):
 print "Ha!"

app = Application() app.master.title("ldapadmin") app.mainloop()


--------------------------------------------- This message was sent from Downeast.Net. http://ellsworthme.com/


_______________________________________________ K12OSN mailing list K12OSN redhat com https://www.redhat.com/mailman/listinfo/k12osn For more info see <http://www.k12os.org>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]