Do.popup() returns incorrectly

Asked by Mike

This code displays the mouse position until OK is pressed:

def locationDisplay():
    lcount = 0
    while True:
        lcount+=1
        mouseposition = Mouse.at()
        print mouseposition
        mslx = str(mouseposition.x)
        msly = str(mouseposition.y)
        bmsg = "Location is " + mslx + "," + msly + " Loop:" + str(lcount)

        print bmsg

        result = Do.popup(bmsg,1)
        print result
        if result is None:
         continue
        exit()
        return

The problem I have is after a random number of loops (between 1 and 29) Do.popup() returns True instead of None even though I haven't pressed OK.

Can you think what might be causing this?

(Windows 10 SikuliX 2.0.5)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

checked with this in your setup:

def mousePos():
    foo = "test %d: %s" % (n, atMouse())
    result = Do.popup(foo, 1)
    print result, foo
    return result

for n in range(50):
    if mousePos(): break

no problems, works as expected, even when moving the mouse around or even when clicking somewhere

Revision history for this message
Mike (maestro+++) said :
#2

Tried it with the mouse stationery, constantly moving, clicking the mouse, pressing keys. It is running on two screens. I tried running it on both screens and moving the mouse to both screens.

With no obvious pattern, in all cases it switched to True after the the following number of loops:

2,4,2,2,16,8,12,1,10,6,6,1,2,4,3,14,5

The instance where it failed on the first call is particularly troubling.

((SikulixIDE-2.0.5 build# dev(2021-03-03_09:10) Windows 10 Home 19043.1151)

Revision history for this message
Mike (maestro+++) said :
#3

My last comment was, for clarity, using your code.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

again tested with 2 screens: works - no problems.

The only difference I can see:
You are running Win10-Home, I have Win10-Pro

So I am sorry, but I do not have any idea.

Revision history for this message
Mike (maestro+++) said :
#5

Thanks for investigating.

Can you help with this problem?

Provide an answer of your own, or ask Mike for more information if necessary.

To post a message you must log in.