Solved

x, y = event.GetPosition()

Posted on 2011-09-07
5
673 Views
Last Modified: 2012-08-14
I figure this is pretty good cod to start with... I want to place an 'X'  on the mouse click then save the x,y coordinate of that 'X' ...  

import wx

class MoveEvent(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)

        wx.StaticText(self, -1, 'x:', (10,0))
        wx.StaticText(self, -1, 'y:', (10,20))
        self.st1 = wx.StaticText(self, -1, '', (30, 0))
        self.st2 = wx.StaticText(self, -1, '', (30, 20))
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Centre()

    def OnMove(self, event):
        x, y = event.GetPosition()
        self.st1.SetLabel(str(x))
        self.st2.SetLabel(str(y))

class MyApp(wx.App):
    def OnInit(self):
        me = MoveEvent(None, -1, 'moveevent.py')
        me.Show(True)
        return True

app = MyApp(0)
app.MainLoop()

Open in new window

0
Comment
Question by:dolamitejenkins
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 36510630
I don't know python but I also don't understand what question you are asking.
0
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 36511287
Here is a similar question-n-answer that you might find useful

http://www.daniweb.com/software-development/python/threads/76884
0
 

Author Closing Comment

by:dolamitejenkins
ID: 36512148
thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum5 challenge 5 85
how to split this type of line? 5 93
object oriented programming comparison 5 72
Not seen Link button 5 40
Introduction On September 29, 2012, the Python 3.3.0 was released; nothing extremely unexpected,  yet another, better version of Python. But, if you work in Microsoft Windows, you should notice that the Python Launcher for Windows was introduced wi…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question