When you use the Actionchains class, you drag and drop once, and then drag the previous element repeatedly.

Source: Internet
Author: User

Background:

In the actual use of the project, multiple elements are dragged to the specified area, and the elements belong to different types. After you drag and drop the first element, and then drag the other elements, you will find that the first element is dragged again.

Course:

1, online search, did not get the answer;

2, flip through the source code of Actionchains, found that it is to store all the action in a _actions variable. Then execute all the actions stored in this array in the Perform method. The code is as follows:

def perform (self):
"""
Performs all stored actions.
"""
For action in Self._actions:
Action ()

The question should be: in the second drag, the _actions array still retains its first drag operation.

The workaround is to empty the _actions array before each drag.

The first idea is whether the action_chains itself has emptied the _actions array. Search throughout the action_chains.py, and no corresponding method was found.

Since there is no, only in your own code, before each execution, the data _actions empty.

Once again, the drag-and-drop code is repeated, and there is no repetition of dragging elements. You can also use eclipse break points to see what the values in this array are at execution time.

When you use the Actionchains class, you drag and drop once, and then drag the previous element repeatedly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.