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

    Status: Open => Answered

RaiMan proposed the following answer:
An OO approach does not depend on SikuliX, but only on the used language
(Python in this case) and your implementation concept.

... but I cannot see any OO concept, just the ide, to use a function
from some other imported script.

detailed comments:

--- main.py
# usually not OO, but simply procedural (workflow)

import shutil
#from geraCPF import geraCPF 
import geraCPF # just so

#class main(): # does not makes sense and the implementation is not
Python-like

myApp = App("Chrome")
App.open("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
myApp.focus()
while not exists("1520001990649.png"):
   observe() # not sure, what this should do??? 
   wait(1)
click("1520001996809.png")
type(geraCPF.cpf_funcional_func()) # the function returns str() anyway
# you have to say module.function()
wait(1)
#exit() # not needed

geraCPF.py
- - -
import random
def cpf_funcional_func():
          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)

I think, you have to step back, to rethink your concept.

Until now I cannot see any need to think in OO, it is just procedural
with using functions.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to