pyswt SWT.NULL

2006-05-28 Thread 3rdshiftcoder
hi-

i am trying to make a pyswt gui and when it gets to this line:
 colType = Combo(self.shell, SWT.NULL)

i get:
colType = Combo(self.shell, SWT.NULL)
AttributeError: NULL

when using swt with java i had to have lots of imports at the beginning of a 
swt file.
are they not needed when using pyswt?

thanks for any help,
jim 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyswt SWT.NULL

2006-05-28 Thread 3rdshiftcoder
I got it.  it is SWT.None

thanks,
jim

"3rdshiftcoder" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> hi-
>
> i am trying to make a pyswt gui and when it gets to this line:
> colType = Combo(self.shell, SWT.NULL)
>
> i get:
> colType = Combo(self.shell, SWT.NULL)
> AttributeError: NULL
>
> when using swt with java i had to have lots of imports at the beginning of 
> a swt file.
> are they not needed when using pyswt?
>
> thanks for any help,
> jim
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


beginner: using parameter in functions

2006-05-31 Thread 3rdshiftcoder
hi-

i am having trouble using parameter values in my function and to be honest a 
little trouble with
member variables.  i am trying to pass in the argument 'd' representing 
delete.
what the code will do is if it is 'd' it will make a delete query template 
string.
if it is an 'i' then insert query etc.

this is the results of my attempt to print the contents of the parameter 
values.
<__main__.getQryStr instance at 0x01151D50> ('d',) me mad


(and on a side note if i dont include the *args i get an invalid number of 
parameters supplied message.)
why is it returning the value in this format ('d',) ?
i cant get x == d
i guess that value 'd' is stored in a tuple and i'd like to get it out of 
there.

so basically the function returns nope as it stands

python is sure different from other languages i have used.

thanks for any help,
jim


class getQryStr:
def __init__(self,op):
print op
self.x = 'd'
def returnStr(x,*args):

print '%s %s me mad' % (x,args)
if x == 'd':
s = Template("delete from columndef where tblid = $tblid and 
colname = $colname")
else:
return 'nope' #this else is just for illustration and testing

d = dict(tblid=t.tblid.getText(), colname=t.colName.getText())

print s.substitute(d)

return s

def delqry(self):

createfldobj = getQryStr('d')
s = createfldobj.returnStr('d')


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: beginner: using parameter in functions

2006-05-31 Thread 3rdshiftcoder
thanks very much John!

so i can have self as function parameter as well as in a method.
that allowed me to use properties to retrieve the value set in the 
constructor.
i just changed the function return statement and it worked.
i was working along these lines but couldnt get it up and running as
fast as you posted.

templating sure is a great way to create dynamic query strings.

very cool so far but still lots to learn.

thanks again,
jim


"John McMonagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Wed, 2006-05-31 at 23:24 +, 3rdshiftcoder wrote:
>> hi-
>>
>> i am having trouble using parameter values in my function and to be 
>> honest a
>> little trouble with
>> member variables.  i am trying to pass in the argument 'd' representing
>> delete.
>> what the code will do is if it is 'd' it will make a delete query 
>> template
>> string.
>> if it is an 'i' then insert query etc.
>>
>> this is the results of my attempt to print the contents of the parameter
>> values.
>> <__main__.getQryStr instance at 0x01151D50> ('d',) me mad
>>
>>
>> (and on a side note if i dont include the *args i get an invalid number 
>> of
>> parameters supplied message.)
>> why is it returning the value in this format ('d',) ?
>> i cant get x == d
>> i guess that value 'd' is stored in a tuple and i'd like to get it out of
>> there.
>>
>> so basically the function returns nope as it stands
>>
>> python is sure different from other languages i have used.
>>
>> thanks for any help,
>> jim
>>
>
>
> Try, the following:
>
> class getQryStr:
>def __init__(self,op):
>print op
>self.x = 'd'
>def returnStr(self, *args):
>
>print '%s %s me mad' % (self.x,args)
>if self.x == 'd':
>s = Template("delete from columndef where tblid = $tblid and
> colname = $colname")
>else:
>return 'nope' #this else is just for illustration and
> testing
>
>d = dict(tblid=t.tblid.getText(), colname=t.colName.getText())
>
>print s.substitute(d)
>
>return s
>
>
> Regards,
>
> John
>
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: beginner: using parameter in functions

2006-05-31 Thread 3rdshiftcoder

"John Machin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

thanks for the help.
it is really appreciated.

i am going to do some more reading in the next couple of days.


jim 


-- 
http://mail.python.org/mailman/listinfo/python-list