← Back to team overview

sikuli-driver team mailing list archive

[Question #665137]: Object orientation in SikuliX

 

New question #665137 on Sikuli:
https://answers.launchpad.net/sikuli/+question/665137

Hi, 

Is it possible to do object orientation in SikuliX? I am trying to do a main file get a method from another file but it's not working. 

main.py
- - - 

import shutil
from geraCPF import geraCPF 

class main():
   myApp = App("Chrome")
   App.open("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
   myApp.focus()
   while not exists("1520001990649.png"):
      observe()
      wait(1)
   click("1520001996809.png")
   type(str(cpf_funcional_func()))
   wait(1)
   exit()


geraCPF.py
- - - 

import random

class geraCPF():
   def __init__(self):
      def cpf_funcional_func(self):                                                                                             
          n = [random.randrange(10) for i in xrange(9)]                                                                                            
      
          s = sum(x * y for x, y in zip(n, range(10, 1, -1)))
          d1 = 11 - s % 11
          if d1 >= 10:
              d1 = 0
          n.append(d1)                                                                                                
      
          s = sum(x * y for x, y in zip(n, range(11, 1, -1)))
          d2 = 11 - s % 11
          if d2 >= 10:
              d2 = 0
          n.append(d2)                                                                                         
          return "%d%d%d%d%d%d%d%d%d%d%d" % tuple(n)


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.