click on button to send adb commmand python
Question: I would like to build a program to send adb commannd to mobile when i click
the buttton, i tried with the following code but the command is not send to
device,I'm new in Python. Please can someone help me to solve this problem

    
    
    from Tkinter import *
    import os
    import subprocess
    
    root = Tk()
    root.title("MUT Tester")
    root.geometry("500x500")
    
    def button():
    
    cmd= os.system("adb devices")
    
    
    b = Button(root, text="Enter", width=30, height=2, command = lambda:(button))
    b.pack()
    
    root.mainloop()
    


Answer: In this line:

    
    
    b = Button(root, text="Enter", width=30, height=2, command = lambda:(button))
    

the button function is not being called by command when you click (replace
button with a print statement to test). Remove the lambda and replace it with
just command = button.

