android monkeyrunner python script with tkinter

321 views Asked by At

I'm using python(v3.6.0) and tkinter is working fine. Now I'm trying to add tkinter to my python script to work with android monkeyrunner tool. When I try to execute execute below command:

C:\Python36\myScript>monkeyrunner C:\Python36\myScript\installApp.py

command, then the following error message is appeared:

[main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
[main] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "C:\Python36\myScript\installApp.py", line 2, in <module>
import tkinter as tk
ImportError: No module named tkinter

I have already added my Python library file path C:\Python36\Lib, in my windows environment variable, but still ImportError: No module name tkinter error occured.

1

There are 1 answers

0
Diego Torres Milano On

The problem is that monkeyrunner is based on jython. You can use AndroidViewClient/culebra which is almost a drop-in replacement, based on python and also uses Tkinter for the UI (see culebra).