Solved

x, y = event.GetPosition()

Posted on 2011-09-07
5
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

626 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