0

I have 2 questions.

So i am making a python program that will backup and restore a selected directory for me.

This is my first program and i am using easygui as my gui for this program.

what i want to know is how i can take a linux command that is executed and display the result of that in a msgbox , or would tkinter be better for this kind of thing?

and how would i go about showing what flash drives are plugged in with this as in showing a drop down menu of the flash drives plugged in that you can pick from.

Huntaz556
  • 117
  • 1
  • 3
  • 12

1 Answers1

1
import commands
from easygui import *

output = commands.getstatusoutput("command")
msgbox(msg=output[1])

That's how you get the output of a command and show it in a message box.

Griffin
  • 644
  • 6
  • 18
  • is there anyway i can do two commands in one box? because when i do os.system('cd /media') it dosent cd back to media – Huntaz556 Oct 30 '11 at 17:27
  • @Huntaz556 As far as I know you can't use `cd` in scripts and programs, you'll have to do whatever you want to do _from_ the directory you ran the script in. You can display two commands in one message box by making a string, adding both outputs into that string and display it in the message box. – Griffin Oct 30 '11 at 17:35