Wednesday 15 August 2012

python - What is the event I can handle dragged and external file onto my frame -


I have worked to drop files on a wx.FileDropTarget inside my frame code. This is not my question.

I'm trying to create a custom "hover" event which called for 1 second after an external drag file over my frame Unfortunately wx.EVT_ENTER_WINDOW when out an external file The drag on the frame is called being received.

I want to constantly check the cursor and avoid collision detection, as your app is more of a utility. (I think my app will be expanded after the small screen using real estate and floating "on a small frame to 1 second")

Ideally, I (code for this event My 1 second timer), that my cursor changes from "file" to "move" cursor when it hits my app.

I'm just learning wx, I'm going away from vb.NET. VB.NET had an event handler for "Control.DragEnter". That's what I'm really looking for. vb.NET equal wxPython to "Control.DragEnter"

  private sub _DragEnter (as in this article, e DragEventArgs) handles Me.DragEnter so e.Data.GetDataPresent ( DataFormats.FileDrop) then e.Effect = DragDropEffects.Move finally tmrHover = new timer AddHandler tmrHover.Tick, AddressOf tmrHover_Tick tmrHover.Interval = 1000 tmrHover.Start () end Sub   

advance Thank you.

Alex

I found the solution it was not clear when I first documentation But here it is for everyone else:

  class MyFileDropTarget: def __init __ (auto, main frame): wx.FileDropTarget .__ init __ (self) self .window = mainframe def OnDropFiles (self, x, y, filename): print str (fil) def OnEnter (self, x, y, NUL): (self.window.OnDragEnter to fil filename) return wx. DragMove def OnLeave (self): self.window.OnDragLeave () Return Not def OnDragOver (auto, X, Y, cord): Return wx.DragMove   

Thanks.

-एक्सक्स

No comments:

Post a Comment