Posted: Fri Apr 05, 2013 8:43 am Post subject: Custom types and Embed Java in Python
Two quick questions:
First, is it possible to create a variable type in python? I'm looking for a type formatted like (x, y) to store co-ordinates that I could call like:
Python:
Point1 = (2, 4)
MoveMouse(Point1.x, Point1.y)
#OR
MoveMouse(Point1[x], Point1[y])
#Preferably not
MoveMouse(Point1[0], Point1[1])
Is this possible?
Second question, I'm working on a Runescape marco'ing client to work on my python skills, but I'm wondering if its even possible to get a Runescape client inside a python GUI. I don't need to be told exactly how to do it, but if someone could tell me what I'd need to do it, or lead me in the right direction, that would be great!
Thanks,
Nathan
Sponsor Sponsor
wtd
Posted: Fri Apr 05, 2013 9:45 am Post subject: RE:Custom types and Embed Java in Python
Tuples are already a part of Python.
code:
>>> type((2,3))
<type 'tuple'>
>>>
Nathan4102
Posted: Fri Apr 05, 2013 12:43 pm Post subject: RE:Custom types and Embed Java in Python
It'll do, but is there any way to address the first number with X and the second with Y like in my example?
wtd
Posted: Fri Apr 05, 2013 12:48 pm Post subject: RE:Custom types and Embed Java in Python
Perhaps you should use a dictionary.
Nathan4102
Posted: Fri Apr 05, 2013 1:38 pm Post subject: RE:Custom types and Embed Java in Python
Dictionaries are supposed to be used like constants, non changing, correct? I'd have my points changing constantly. Is there really no way to create a new variable type?
wtd
Posted: Fri Apr 05, 2013 2:48 pm Post subject: RE:Custom types and Embed Java in Python
Posted: Fri Apr 05, 2013 3:02 pm Post subject: RE:Custom types and Embed Java in Python
Alright, ill make that work. Thanks!
Nathan4102
Posted: Fri Apr 05, 2013 3:22 pm Post subject: RE:Custom types and Embed Java in Python
Still looking for answers to my second question!
Sponsor Sponsor
wtd
Posted: Fri Apr 05, 2013 3:59 pm Post subject: RE:Custom types and Embed Java in Python
Of course, you could always just make a TwoDimensionalPoint class...
Nathan4102
Posted: Fri Apr 05, 2013 4:12 pm Post subject: RE:Custom types and Embed Java in Python
OOP and classes are new to me, could you explain?
Cancer Sol
Posted: Fri Apr 05, 2013 5:53 pm Post subject: Re: Custom types and Embed Java in Python
Even though I'm not sure if it's the right place to ask, but can someone please lead me in the right direction, for Nathan's second question, except, in C++.
It'd be great if someone could just do in Python, idc really, just so that I know what to do
Nathan4102
Posted: Fri Apr 05, 2013 6:34 pm Post subject: RE:Custom types and Embed Java in Python
A browser might work too, as long as it could run a java applet...
linuxp
Posted: Sat Apr 06, 2013 1:24 am Post subject: Re: Custom types and Embed Java in Python
class?
code:
class pos:
def __init__(self,x,y):
self.x = x
self.y = y
pa = pos(10,20)
move(pa.x,pa.y)
Tony
Posted: Sat Apr 06, 2013 1:37 am Post subject: RE:Custom types and Embed Java in Python
@Nathan ? it might help if you explain what you want to do with the Java.