1
from tkinter import *
import os


pencere = Tk()
pencere.title("Hello")
pencere.geometry("550x550")
label1 = Label(text="Hallo",font="bold 25")
label1.place(x=150,y=30)

label2 = Label(text="Command")
label2.place(x=5,y=90)

label3 = Entry(width=50)
label3.place(x=50,y=90)

def gitbash():
    os.startfile('C:\\Program Files\\Git\\git-bash.exe')

ac = Button(text="Olustur",width=10,height=3,command = cmd)
ac.place(x=100,y=150)


pencere = mainloop()

I want to send commands to GitBash from gitbash function. For example I want to send "ls" command, when I open Button, GitBash should be opened and ls command will be sent.

1 Answer 1

1

to do that u can use a module called subprocess

import subprocess

subprocess.run("ipconfig", shell=True, capture_output=True)

this piece of code will run ipconfig and it will run in the shell and the output would also be captured

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.