Git Product home page Git Product logo

Comments (10)

twobob avatar twobob commented on August 21, 2024

I know this is a noob error but...

here is an example: "me.py"

#!/usr/bin/python

import macropolo
macro = macropolo.Macro()
area = [300,300,500,340]

if __name__ == '__main__':
    count = macro.pixel_color_in_area_counter(area, "#c41102")

    point = macro.wait_for_pixel_color_in_area(area, "#c41102", 8000)
    print count
    print point

me@computer /usr/local/src $ python ./me.py

Traceback (most recent call last):
File "./me.py", line 14, in
point = macro.wait_for_pixel_color_in_area(area, "#c41102", 8000)
File "/usr/local/lib/python2.7/dist-packages/macropolo.py", line 262, in wait_for_pixel_color_in_area
exists, point = pixel_color_in_area(rectangle, color)
NameError: global name 'pixel_color_in_area' is not defined

I must be doing the import wrong or something? but I am failing to work it out???

from macropolo.

hytromo avatar hytromo commented on August 21, 2024

Hello twobob and thanks for your interest for my library.

The library was actually Class-free, but it was suggested to make it
class"able".

After making it class"able" (which means you will have to create an object
of the class to call functions) I didn't do much of testing.

The error you see is a bug from inside the library. I will try to correct
it as soon as possible and upload the correct version :)

from macropolo.

twobob avatar twobob commented on August 21, 2024

okay thanks. :)

I added a very crappy bit of mouse moving... (slide_cursor_to)

I totally suck at python (this would be my first go)

but will arrange a pull if it seems worthwhile.

Much obliged.

from macropolo.

twobob avatar twobob commented on August 21, 2024

twobob@c23234c

it's pretty horrible...

but seems to work marginally well...

from macropolo.

hytromo avatar hytromo commented on August 21, 2024

Nice. Don't be too harsh to yourself. I don't know python well myself. I
only know kind of well C++.

I suck very hard at using git, thought. Can you please tell me how to merge
your new function to my already existent branch?

from macropolo.

hytromo avatar hytromo commented on August 21, 2024

Anyway, I found some time and fixed the code. I think everything should be
working fine now.

from macropolo.

cmoang avatar cmoang commented on August 21, 2024

Have never tried before python, but the library's comments seem extremely helpful.

I notice you used import macropolo. After downloading the file, what do I have to do in order to get it work in an Ubuntu/GNU Linux system? In other words, how do I install the library? I tried with pip install macropolo but this does not work. Thanks!

from macropolo.

hytromo avatar hytromo commented on August 21, 2024

Hey there :) You must download the file and put it into the directory of
your Python script. Then, in your script you must use

import macropolo

and then you will be able to use the library's functions :) Oh, but don't
forget to install the required packages before using it!

If you need further help on how to use the library, please don't hesitate
to reply back!

from macropolo.

cmoang avatar cmoang commented on August 21, 2024

Hi again, I know it isn't your job to learn me how to work with macropolo.py, but I'll ask anyway :)
I want to write a simple python script (totally noob in python) that uses your function wait_for_pixel_color_in_area . But I get:

$ python ./test.py 
Traceback (most recent call last):
  File "./test.py", line 5, in <module>
    wait_for_pixel_color_in_area(self, [100, 100, 600, 300], FFFFFF, 10)
NameError: name 'wait_for_pixel_color_in_area' is not defined

The script is exactly this:

#!/usr/bin/python -W ignore::DeprecationWarning
import macropolo
wait_for_pixel_color_in_area(self, [100, 100, 600, 300], FFFFFF, 10)

What am I doing wrong?

Thanks!

from macropolo.

hytromo avatar hytromo commented on August 21, 2024

Hello cmoang and sorry for the late reply.

As you can see in the code example here:
http://melloristudio.com/macropolo#downloads you will have to initialize an
object of class Macro first and then call the functions with it.'

If my reply wasn't really helpful, inform me and I will try to elaborate.

On Wed, Oct 1, 2014 at 1:29 AM, cmoang [email protected] wrote:

Hi again, I know it isn't your job to learn me how to work with
macropolo.py, but I'll ask anyway :)
I want to write a simple python script (totally noob in python) that uses
your function wait_for_pixel_color_in_area . But I get:

$ python ./test.py
Traceback (most recent call last):
File "./test.py", line 5, in
wait_for_pixel_color_in_area(self, [100, 100, 600, 300], FFFFFF, 10)
NameError: name 'wait_for_pixel_color_in_area' is not defined

The script is exactly this:

#!/usr/bin/python -W ignore::DeprecationWarningimport macropolowait_for_pixel_color_in_area(self, [100, 100, 600, 300], FFFFFF, 10)

What am I doing wrong?

Thanks!


Reply to this email directly or view it on GitHub
#1 (comment).

from macropolo.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.