Drag and drop option is very useful to users and it is found in many desktop applications. It allows to copy or move objects from one window to another just by dragging it with the mouse and dropping on another window.
Drag and drop operation involves below steps
In wxPython, there are two predefined drop targets
Many wxPython widgets support drag and drop activity. Source control should have dragging enabled whereas target control should be in a position to accept (or reject) drag.
Source Data that the user is dragging will be placed on the the target object. OnDropText() of target object will consume the data. If required, data from the source object can be deleted.
In below example, two ListCrl objects are placed horizontally in a Box Sizer. List on the left is populated with a languages data and is selected as the source of drag one on the right is the target.
Second list control is empty and is an argument for object of TextDropTarget class.
OnDropText() method will add source data in the target list control.
Drag operation is initialized by the event binder.
OnDragInit() function puts drag data on the target and deletes from the source.
Complete code is as follows
Above code produces the following output
wxPython Related Interview Questions
|Perl Scripting Interview Questions||C++ Interview Questions|
|PHP Interview Questions||C Interview Questions|
|Ruby on Rails Interview Questions||Ruby Interview Questions|
|Django Interview Questions||Lisp programming Interview Questions|
|R Programming language Interview Questions||wxPython Interview Questions|
|Python Automation Testing Interview Questions|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.