Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
tkinter.dnd.Icon Class Reference

List of all members.

Public Member Functions

def __init__
def attach
def detach
def press
def move
def putback
def where
def dnd_end

Public Attributes

 name
 canvas
 label
 id
 x_off
 y_off
 y_orig

Detailed Description

Definition at line 208 of file dnd.py.


Constructor & Destructor Documentation

def tkinter.dnd.Icon.__init__ (   self,
  name 
)

Definition at line 210 of file dnd.py.

00210 
00211     def __init__(self, name):
00212         self.name = name
00213         self.canvas = self.label = self.id = None

Here is the caller graph for this function:


Member Function Documentation

def tkinter.dnd.Icon.attach (   self,
  canvas,
  x = 10,
  y = 10 
)

Definition at line 214 of file dnd.py.

00214 
00215     def attach(self, canvas, x=10, y=10):
00216         if canvas is self.canvas:
00217             self.canvas.coords(self.id, x, y)
00218             return
00219         if self.canvas:
00220             self.detach()
00221         if not canvas:
00222             return
00223         label = tkinter.Label(canvas, text=self.name,
00224                               borderwidth=2, relief="raised")
00225         id = canvas.create_window(x, y, window=label, anchor="nw")
00226         self.canvas = canvas
00227         self.label = label
00228         self.id = id
00229         label.bind("<ButtonPress>", self.press)

Here is the call graph for this function:

def tkinter.dnd.Icon.detach (   self)

Definition at line 230 of file dnd.py.

00230 
00231     def detach(self):
00232         canvas = self.canvas
00233         if not canvas:
00234             return
00235         id = self.id
00236         label = self.label
00237         self.canvas = self.label = self.id = None
00238         canvas.delete(id)
00239         label.destroy()

Here is the caller graph for this function:

def tkinter.dnd.Icon.dnd_end (   self,
  target,
  event 
)

Definition at line 265 of file dnd.py.

00265 
00266     def dnd_end(self, target, event):
00267         pass

def tkinter.dnd.Icon.move (   self,
  event 
)

Definition at line 248 of file dnd.py.

00248 
00249     def move(self, event):
00250         x, y = self.where(self.canvas, event)
00251         self.canvas.coords(self.id, x, y)

Here is the call graph for this function:

Here is the caller graph for this function:

def tkinter.dnd.Icon.press (   self,
  event 
)

Definition at line 240 of file dnd.py.

00240 
00241     def press(self, event):
00242         if dnd_start(self, event):
00243             # where the pointer is relative to the label widget:
00244             self.x_off = event.x
00245             self.y_off = event.y
00246             # where the widget is relative to the canvas:
00247             self.x_orig, self.y_orig = self.canvas.coords(self.id)

Here is the call graph for this function:

Here is the caller graph for this function:

def tkinter.dnd.Icon.putback (   self)

Definition at line 252 of file dnd.py.

00252 
00253     def putback(self):
00254         self.canvas.coords(self.id, self.x_orig, self.y_orig)

def tkinter.dnd.Icon.where (   self,
  canvas,
  event 
)

Definition at line 255 of file dnd.py.

00255 
00256     def where(self, canvas, event):
00257         # where the corner of the canvas is relative to the screen:
00258         x_org = canvas.winfo_rootx()
00259         y_org = canvas.winfo_rooty()
00260         # where the pointer is relative to the canvas widget:
00261         x = event.x_root - x_org
00262         y = event.y_root - y_org
00263         # compensate for initial pointer offset
00264         return x - self.x_off, y - self.y_off

Here is the caller graph for this function:


Member Data Documentation

Definition at line 212 of file dnd.py.

Definition at line 212 of file dnd.py.

Definition at line 212 of file dnd.py.

Definition at line 211 of file dnd.py.

Definition at line 243 of file dnd.py.

Definition at line 244 of file dnd.py.

Definition at line 246 of file dnd.py.


The documentation for this class was generated from the following file: