Re: [Tutor] Why is the name "self" optional instead of mandatory?

2016-01-21 Thread DiliupG
The answer to this will be an interesting read... :)

This
email has been sent from a virus-free computer protected by Avast.
www.avast.com

<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Jan 21, 2016 at 11:10 AM, Cameron Simpson  wrote:

> On 20Jan2016 21:42, boB Stepp  wrote:
>
>> I'm whizzing along in "Python Crash Course" and am in the chapter on
>> classes.  Just to satisfy my suspicion that "self" is just a
>> placeholder for creating an object instance,
>>
>
> No, it is a placeholder for a _preexiting_ object instance.
>
> [...]
>
>> So I really only have one question:  Why not make Python's
>> *traditional* name, "self", mandatory?  Why give the programmer this
>> kind of choice?  [OK, that was two questions.]
>>
>
> Why make it mandatory? What benefit would it bring? Remember, one can
> write nonsense or impossible to read gibberish in any language; most people
> don't try to. So to repeat my question: why make it mandatory?
>
> Cheers,
> Cameron Simpson 
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Program Arcade Games Help

2016-03-12 Thread DiliupG
All the help and guidance you need are in the pages here.

http://programarcadegames.com/

if you follow the book slowly from the start you shouldn't have a problem.
If you do, stackoverflow is a good place to ask.
When ever you ask a question try to give as much details as possible so
that who ever answers do not have to go searching over the web to figure
out what you are asking.

Lab 9 deals with questions on functions. If you are unable to do these it
most probably means that you have not grasped the concepts of what
functions are. Again stackoverflow and Daniweb are good places of reference
to learn more.


On Fri, Mar 11, 2016 at 8:41 PM, Ethan Batterman 
wrote:

> I am really struggling with Lab 9: Functions pt 3 and 4 of program arcade
> games. Any help or guidance would be greatly appreciated. I am completely
> lost. Thank you in advance!
>
>
> Ethan
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Drawing simple graphics objects

2016-04-06 Thread DiliupG
If you really want learn graphics programming with Python then learning
Pygame is the best way to go.All these other things are pretty much simple
stuff. The easiest way is to start learning by setting yourself objectives
and trying to fulfill  them.  Given below is one of the BEST sources to
learn Pygame.

http://thepythongamebook.com/en:pygame:start

This is another excellent course

http://programarcadegames.com/index.php?chapter=example_code&lang=en

here are video tutorial. Professor Craven is fantastic.

https://www.youtube.com/user/professorcraven

Last but not the least have a look at Peter Collinridges site. He will
teach you great stuff.

http://www.petercollingridge.co.uk/


On Mon, Apr 4, 2016 at 8:47 AM, Ashley Jacobs 
wrote:

> Hi,
> could you help me with python 3.5 coding for graphics?
>
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] (no subject)

2016-07-24 Thread DiliupG
I am using Python 2.7.12 on Windows 10

filename = "මේක තියෙන්නේ සිංහලෙන්.txt"
Why can't I get Python to print the name out?

filename =  "මේක තියෙන්නේ සිංහලෙන්.txt"
Unsupported characters in input

filename = u"මේක තියෙන්නේ සිංහලෙන්.txt"
Unsupported characters in input

above is the python ide output

Even from within a program I cant get this to print.

any help? Please dont ask me to use python 3.

:)

-- 
Kalasuri Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2016-07-26 Thread DiliupG
Thank you for the responses.
Some filenames I use are in Unicode in this script and there is no display
or typing problem in Windows (Vista, 7 and 10). Filenames and text in word
processing and text files are ALL displayed properly WITHOUT any errors by
the Windows system.

When I use a standard font in the local language there is no problem at all
but I need to retype ALL display text in all the Python programs which is a
tedious task.

Having read all answers is there no way this can be done without modifing
code on my computer? Thepurpose is to deliver a WIndows software for ALL
Windows users.

I am reading in a list of file names with the following code.

def get_filelist(self):
""""""
app = QtGui.QApplication(sys.argv)
a = QtGui.QFileDialog.getOpenFileNames()

filelist = []
if a:
for name in a:
a = unicode(name)

filelist.append(a)

return filelist

mainprg.filelist = mainprg.get_filelist()

filelist = mainprg.filelist

for name in filelist:
print name <  THIS IS WHERE THE PROBLEM IS

Thanks for feed back.

On Mon, Jul 25, 2016 at 3:58 PM, Steven D'Aprano 
wrote:

> On Fri, Jul 22, 2016 at 01:08:02PM +0530, DiliupG wrote:
> > I am using Python 2.7.12 on Windows 10
>
> Two errors:
>
> - first error is that Unicode strings in Python 2 need to be written as
> unicode objects, with a "u" prefix in the delimiter:
>
> # ASCII byte string:
> "Hello World"
>
> # Unicode string:
>
> u"මේක ත"
>
> ASCII strings "..." cannot give you the right results except by
> accident. You must use unicode strings u"..."
>
> - Second possible problem: using Windows, which may not support the
> characters you are trying to use. I don't know -- try it and see. If it
> still doesn't work, then blame Windows. I know that Linux and Mac OS X
> both use UTF-8 for filenames, and so support all of Unicode. But
> Windows, I'm not sure. It might be localised to only use Latin-1
> (Western European) or similar.
>
>
> --
> Steve
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Kalasuri Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2016-07-26 Thread DiliupG
Thanks for the support.

Mu main problem was in the editor I was using which I did not mention.

I was using Wing IDE Pro instead of the Python IDE. BY the answer given by
erik sun I applied the same idea to th Wing IDE i/o to utf-8 and everything
worked. Thanks for your support and pardon me for not supplying all the
info.

On Tue, Jul 26, 2016 at 10:11 AM, DiliupG  wrote:

> Thank you for the responses.
> Some filenames I use are in Unicode in this script and there is no display
> or typing problem in Windows (Vista, 7 and 10). Filenames and text in word
> processing and text files are ALL displayed properly WITHOUT any errors by
> the Windows system.
>
> When I use a standard font in the local language there is no problem at
> all but I need to retype ALL display text in all the Python programs which
> is a tedious task.
>
> Having read all answers is there no way this can be done without modifing
> code on my computer? Thepurpose is to deliver a WIndows software for ALL
> Windows users.
>
> I am reading in a list of file names with the following code.
>
> def get_filelist(self):
> """"""
> app = QtGui.QApplication(sys.argv)
> a = QtGui.QFileDialog.getOpenFileNames()
>
> filelist = []
> if a:
> for name in a:
> a = unicode(name)
>
> filelist.append(a)
>
> return filelist
>
> mainprg.filelist = mainprg.get_filelist()
>
> filelist = mainprg.filelist
>
> for name in filelist:
> print name <  THIS IS WHERE THE PROBLEM IS
>
> Thanks for feed back.
>
> On Mon, Jul 25, 2016 at 3:58 PM, Steven D'Aprano 
> wrote:
>
>> On Fri, Jul 22, 2016 at 01:08:02PM +0530, DiliupG wrote:
>> > I am using Python 2.7.12 on Windows 10
>>
>> Two errors:
>>
>> - first error is that Unicode strings in Python 2 need to be written as
>> unicode objects, with a "u" prefix in the delimiter:
>>
>> # ASCII byte string:
>> "Hello World"
>>
>> # Unicode string:
>>
>> u"මේක ත"
>>
>> ASCII strings "..." cannot give you the right results except by
>> accident. You must use unicode strings u"..."
>>
>> - Second possible problem: using Windows, which may not support the
>> characters you are trying to use. I don't know -- try it and see. If it
>> still doesn't work, then blame Windows. I know that Linux and Mac OS X
>> both use UTF-8 for filenames, and so support all of Unicode. But
>> Windows, I'm not sure. It might be localised to only use Latin-1
>> (Western European) or similar.
>>
>>
>> --
>> Steve
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>
>
> --
> Kalasuri Diliup Gabadamudalige
>
> http://www.diliupg.com
> http://soft.diliupg.com/
>
>
> **
> This e-mail is confidential. It may also be legally privileged. If you are
> not the intended recipient or have received it in error, please delete it
> and all copies from your system and notify the sender immediately by return
> e-mail. Any unauthorized reading, reproducing, printing or further
> dissemination of this e-mail or its contents is strictly prohibited and may
> be unlawful. Internet communications cannot be guaranteed to be timely,
> secure, error or virus-free. The sender does not accept liability for any
> errors or omissions.
>
> **
>
>


-- 
Kalasuri Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor