Re: [Tutor] Given a string, call a function of that name

2017-05-17 Thread boB Stepp
On Wed, May 17, 2017 at 1:42 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: >> Oh, and I suppose I should ask for a critique of the code as written >> for appropriate Python style, proper targeted function use, etc. I am >> always eager to learn! > >> if function in valid_fcns:

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Thu, May 18, 2017 at 1:58 AM, Michael C wrote: > when I run this, while it's called test.pyw, this pops up > > from PIL import Image > > im = Image.open('1.bmp') > im.show() Ok, I stand corrected. It's something weird, and most likely due to Windows support

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Wed, May 17, 2017 at 10:33 PM, Michael C wrote: > On Wed, May 17, 2017 at 3:30 PM, eryk sun wrote: > >> You're probably running a .py script that's associated with py.exe or >> python.exe. These executables create a new console (i.e. an

Re: [Tutor] Bug

2017-05-17 Thread Cameron Simpson
On 17May2017 12:26, Grace Sanford wrote: Theoretically, the following code is suppose to check if the user has won a tic tac toe game by checking if there are all "X"s in either the horizontal, vertical, or diagonal lines of a grid (represented by a list with "board" with

Re: [Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 20:50, Stephen P. Molnar wrote: > I'm beginning to think that I don't know how to ask the question as > Google and Stack Overflow have resulted in nothing. All of the results > seem to deal with integers. Have you tried asking on the scipy forum?

Re: [Tutor] How do I display a picture?

2017-05-17 Thread Alan Gauld via Tutor
On 18/05/17 00:24, Michael C wrote: > or to find another way to display the picture without using python image > library. There are lots of ways it depends on what you actually want to do with the image. For example you can run your favourite image viewer program(that looks like what PIL is

Re: [Tutor] Fwd: Re: How do I display a picture?

2017-05-17 Thread Alan Gauld via Tutor
On 18/05/17 00:38, Alan G via Tutor wrote: >Please always use reply all, or reply list when responding to list Oops, it seems like you did that already, my apologies. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my

Re: [Tutor] How do I display a picture?

2017-05-17 Thread Michael C
I use python image library and apparently when I do im = Image.open('1.png') im.show() show() actually opens a empty console window that doesn't do anything and as long as it's around the script hangs. Currently I have to close it by clicking on the close button and it makes my script useless.

Re: [Tutor] copy/paste/move files

2017-05-17 Thread Michael C
Ok! On Wed, May 17, 2017 at 4:11 PM, Alan Gauld via Tutor wrote: > On 17/05/17 20:09, Michael C wrote: > > > How do I move files to a designated folder or copy/paste? > > copy/paste is a UI specific thing, you don't do that in Python code. > What you do is either copy a file

Re: [Tutor] Help finishing a function

2017-05-17 Thread Alan Gauld via Tutor
Please use Reply-All or Reply-List when replying to the list, otherwise it only goes to me. On 17/05/17 17:21, Grace Sanford wrote: > Syntactically speaking, how can I check if an element in the list > "board" at position p equals "_" and then change that element to "0"? You can use the ==

[Tutor] Fwd: Re: How do I display a picture?

2017-05-17 Thread Alan G via Tutor
Please always use reply all, or reply list when responding to list messages. I think eryksun may have already answered your question, if not give more info about how you run your code. Original Message Subject: Re: [Tutor] How do I display a picture? From:

Re: [Tutor] copy/paste/move files

2017-05-17 Thread Alex Kleider
On 2017-05-17 12:09, Michael C wrote: Hi all, How do I move files to a designated folder or copy/paste? The first hit when I googled "how to move a file using python" was http://stackoverflow.com/questions/8858008/how-to-move-a-file-in-python which in turn suggests the use of: os.rename() or

Re: [Tutor] How do I display a picture?

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 21:33, Michael C wrote: > How do I display a picture? What do you mean? What kind of picture? Where do you want it displayed (what kind of window/screen)? There are a dozen possible ways to "display a picture" depending on what you specifically want. -- Alan G Author of the Learn

Re: [Tutor] copy/paste/move files

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 20:09, Michael C wrote: > How do I move files to a designated folder or copy/paste? copy/paste is a UI specific thing, you don't do that in Python code. What you do is either copy a file or move it. The shutil module provides easy functions for both. See the documentation for the

Re: [Tutor] Help - What is the best package to learn programming in Python?

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 19:17, keith quach wrote: > I hope you could help. I am new to the Python community. I am looking > for your recommendation for a Windows 10 (64 bit) Python 3.6 > distribution package that covers all the necessary installtions/files. It depends on what you want to do. There is no

Re: [Tutor] Bug

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 17:26, Grace Sanford wrote: > with "board" with elements 0-8). If one of these is the case, it is > suppose to print the "You won" string. Nevertheless, when I change list > variable to reflect one of these conditions, there is no printing > occurring. I cannot figure out why. You

Re: [Tutor] Python Image Library

2017-05-17 Thread Michael C
Actually, that is the whole script! I didn't get used to have the cmd.exe window pop up at all, could it be something I did? Or, is there a way to suppress that from showing up? thanks! On Wed, May 17, 2017 at 3:30 PM, eryk sun wrote: > On Wed, May 17, 2017 at 8:24 PM,

Re: [Tutor] Python Image Library

2017-05-17 Thread eryk sun
On Wed, May 17, 2017 at 8:24 PM, Michael C wrote: > from PIL import Image > > im = Image.open('pic.bmp') > im.show() > > I ran this code and it not only opened the picture in paint, which is what > I want, but it also opens a CMD.exe console window! how do I

[Tutor] How do I display a picture?

2017-05-17 Thread Michael C
Hi all, How do I display a picture? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Python Image Library

2017-05-17 Thread Michael C
from PIL import Image im = Image.open('pic.bmp') im.show() I ran this code and it not only opened the picture in paint, which is what I want, but it also opens a CMD.exe console window! how do I prevent that from happening? thanks! ___ Tutor

[Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-17 Thread Stephen P. Molnar
I'm beginning to think that I don't know how to ask the question as Google and Stack Overflow have resulted in nothing. All of the results seem to deal with integers. I have a number of single column floating point arrays each containing 300 entries that I want to combine into a n by 300

Re: [Tutor] Python Image Library

2017-05-17 Thread Michael C
in fact, when I ran this: import os os.system("mspaint 1.bmp") It also opened a cmd.exe window and the script wouldn't continue until I closed the cmd window! On Wed, May 17, 2017 at 1:24 PM, Michael C wrote: > from PIL import Image > > > im =

[Tutor] Help - What is the best package to learn programming in Python?

2017-05-17 Thread keith quach
Hi, I hope you could help. I am new to the Python community. I am looking for your recommendation for a Windows 10 (64 bit) Python 3.6 distribution package that covers all the necessary installtions/files. Thanks, Keith ___ Tutor maillist -

[Tutor] copy/paste/move files

2017-05-17 Thread Michael C
Hi all, How do I move files to a designated folder or copy/paste? thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Matplotlib error with Python

2017-05-17 Thread Pooja Bhalode
Hi Alan, Yes, that was the issue, I had a tempfile.py created my me some time back. That was interfering with this one. Thanks a lot for your input. Hope you have a great day! Pooja On Wed, May 17, 2017 at 11:27 AM, Alan Gauld via Tutor wrote: > On 17/05/17 15:07, Pooja

[Tutor] Bug

2017-05-17 Thread Grace Sanford
Theoretically, the following code is suppose to check if the user has won a tic tac toe game by checking if there are all "X"s in either the horizontal, vertical, or diagonal lines of a grid (represented by a list with "board" with elements 0-8). If one of these is the case, it is suppose to

Re: [Tutor] Matplotlib error with Python

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 15:07, Pooja Bhalode wrote: > */Users/poojabhalode/.bash_profile: line 1: .bashrc: No such file or > directory* I'd start with this one. Where is the bash script error coming from? Is there really no .bashrc? If not what is the impact of not having it? I'm also not clear what is

Re: [Tutor] Help finishing a function

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 14:31, Grace Sanford wrote: > I am wondering if someone can help/advise me on finishing the code for this > function: Please only send one email for a given i8ssue it gets confusing when people start responding to two different threads about the same question. Also please give us

[Tutor] Matplotlib error with Python

2017-05-17 Thread Pooja Bhalode
*Hi, * *I have been working on a graphic user interface with matplotlib and suddenly(Earlier, I didnt get these errors, and when I opened the files now, I am) getting these errors: * */Users/poojabhalode/.bash_profile: line 1: .bashrc: No such file or directory* *[[ 2 -1 0]* * [-1 2 -1]* * [ 0

[Tutor] Help finishing a function

2017-05-17 Thread Grace Sanford
I am wondering if someone can help/advise me on finishing the code for this function: import turtle import time import random # This list represents the board. It's a list # of nine strings, each of which is either # "X", "O", "_", representing, respectively, # a position occupied by an X, by an

[Tutor] Help writing a function

2017-05-17 Thread Grace Sanford
I need suggestions/help for writing the following function: import turtle import time import random # This list represents the board. It's a list # of nine strings, each of which is either # "X", "O", "_", representing, respectively, # a position occupied by an X, by an O, and # an unoccupied

Re: [Tutor] Given a string, call a function of that name

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 03:49, boB Stepp wrote: > corresponding to one of his functions or methods, if he could use that > word to run a function of the same name. I said I had done something > once where I used the word as a dictionary key, which was then used to > call the function. That's the usual

Re: [Tutor] turtle question

2017-05-17 Thread Peter Otten
Grace Sanford wrote: > how do you reset the turtle's position without drawing a line from where > it last was? Call turtle.penup() when you want to prevent it from drawing and pendown() to have it draw again. Example: import turtle for i in range(10): # draw a 20 units line

Re: [Tutor] Given a string, call a function of that name

2017-05-17 Thread Peter Otten
boB Stepp wrote: > My son (Now 13 years old.) is merrily programming away in Python 3 (Of > course!) and has many projects he is working on. Today he resumed > work on his efforts to create a natural language parser, which he > hopes will enable people to type in commands to a DnD-like game