Search code examples
pythontkinterusb-flash-driveeasygui

python with flashdrives and linux commands


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.


Solution

  • 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.