You Are Here:

Community: Developer Discussion Boards

#1 Old X,Y in Rectangle - 2008-09-26, 17:32

Join Date: Jul 2008
Posts: 15
dinnerdog
Offline
Registered User
Is there anything in the existing PYS60 library which allows you to check whether an x,y coordinate is within a rectangle drawn on the screen.

Thanks
Dinnerdog
Reply With Quote

#2 Old Re: X,Y in Rectangle - 2008-09-26, 18:07

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Online
Forum Nokia Champion
Quote:
Originally Posted by dinnerdog View Post
Is there anything in the existing PYS60 library which allows you to check whether an x,y coordinate is within a rectangle drawn on the screen.

Thanks
Dinnerdog
hi dinnerdog
AFAIK there is no direct method to do what you want. But you can make your own algorithm for that like making your rectangle and then check wheather the coordinates can be compared or not.
Sorry this is just a hint.

Enjoy Pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#3 Old Re: X,Y in Rectangle - 2008-09-26, 18:16

Join Date: Feb 2006
Posts: 168
Location: Helsinki, Finland
RICH?
Offline
Regular Contributor
There is nothing built in but it is relatively easy to make your own function to do this. You only need to know the coordinate of the given point and the coordinates of the rectangle.
Code:
def pointInRect(p,rect):
    if p[0]>=rect[0] and p[0]<=rect[2] and p[1]>=rect[1] and p[1]<=rect[3]:
        return True
    return False

#Rectangle format must be top left corner first and then the bottom right corner
rect = [10,10,20,20]
point = [12,13]

print pointInRect(point,rect)
the above function returns true if the point is in the rectangle, false otherwise.
hope that helped


Nokia E66
PyS60 1.4.4 final
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
drawing a rectangle Jeepy General Symbian C++ 5 2009-01-19 11:39
Transparant Rectangle, possible ? Tiger79 Mobile Java General 4 2008-08-22 16:24
Help me to draw line and rectangle RB_Sahu Symbian User Interface 6 2008-03-10 11:40
Drawing rectangle usuf Symbian Media (Graphics & Sounds) 6 2008-01-18 07:31
Efficiency: drawing rectangle or using label xhsoldier General Symbian C++ 6 2008-01-07 07:24

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia