You are not logged in.
Pages: 1
Hi, im learning a bit about Tk, and im making a little script that show your architecture(i686,etc). This is my code:
mport os
from Tkinter import *
root = Tk()
frame = Frame(root, width=500, height=100)
frame.pack()
label = Label(frame, text="Press Get! to know your arch.")
label.pack()
def get():
v = StringVar()
v.set(os.system('arch'))
out = Label(frame, textvariable=v, bg="black", fg="white")
out.pack()
button = Button(frame, text="Get!", command=get)
button.pack()
root.mainloop()
But i cant get the arch command out printed in a label, i get a '0'...
Last edited by B4RR13N705 (2009-08-17 18:12:54)
OS -----> Arch Linux DE -----> KDE4
CPU ---> 2.66GHz RAM ---> 512 MB
SWAP -> 2 G / -------> 10 G
/home -> 50 G /boot ---> 64 MB
Offline
The zero returned is the exit value/return value from the command 'arch' not stdout.
you probably want to use os.popen() instead, possibly os.popen('arch').read().
I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.
Offline
Pages: 1