Re: exit from Tkinter mainloop Python 2.7

2016-02-24 Thread Dave Farrance
kevind0...@gmail.com wrote: >from Tkinter import * > >def butContinue(): >root1.destroy() As Christian said, you're destroying the root window and its children, so instead use root1.quit() here. > ... > >root1.mainloop() > >print entryName.get("1.0", "end-1c" ) >print entryPWord.get("1.0", "

Re: [newbie] Problem with matplotlib

2016-02-20 Thread Dave Farrance
Dave Farrance wrote: >It occurs to me now that the trackback might misidentify the module in >use, if say, you'd named a file "numbers.py" then got rid of it later >leaving a "numbers.pyc" somewhere. If so, see where it is: > >import numbers >print nu

Re: [newbie] Problem with matplotlib

2016-02-20 Thread Dave Farrance
It occurs to me now that the trackback might misidentify the module in use, if say, you'd named a file "numbers.py" then got rid of it later leaving a "numbers.pyc" somewhere. If so, see where it is: import numbers print numbers.__file__ -- https://mail.python.org/mailman/listinfo/python-list

Re: [newbie] Problem with matplotlib

2016-02-20 Thread Dave Farrance
jenswaelk...@gmail.com wrote: > File "/usr/lib/python2.7/decimal.py", line 3744, in >_numbers.Number.register(Decimal) >AttributeError: 'module' object has no attribute 'Number' Your decimal module seems broken. Confirm that in the Python shell: import numbers print numbers.Number I'm gue

Re: Tkinter problem: TclError> couldn't connect to display ":0

2016-02-05 Thread Dave Farrance
gemjack...@gmail.com wrote: >This fixed my problem with thkinter. sudo cp ~/.Xauthority ~root/ Which means that you were creating a GUI window with Python as root, which is to be avoided if you can. If you can't avoid it and you're running it with sudo in a bash console, rather than a root

Re: Install Numba on Debian

2016-01-23 Thread Dave Farrance
Dave Farrance wrote: >I'd like to install Numba on Debian Jessie to work with the system >Python 2.7.9 (rather than installing Anaconda). OK, never mind. Fixed. By Googling the first error code, finding a suggested fix for that, running again, Googling the new error, and several

Install Numba on Debian

2016-01-23 Thread Dave Farrance
I'd like to install Numba on Debian Jessie to work with the system Python 2.7.9 (rather than installing Anaconda). When I follow the instructions at https://github.com/numba/numba#custom-python-environments ...I get errors when trying to install Numba either with the git clone method or installin

Re: help

2016-01-15 Thread Dave Farrance
sam Rogers wrote: >  I have downloaded python 2.7  with no problem. It works. I am trying to get >pyserial to work. I have tried many different solutions. I am not  sure if it >works or not. How can I be sure? I am using windows 7.  I did not see any help >at python.org. Can you help? >PS my g

Re: Turtle

2016-01-15 Thread Dave Farrance
Stallone Carl wrote: >I am currently using python 3.5.0 and I have been trying to write a program >using turtle but is not seem to be working. I have followed all tutarial on >the web and when i compare it with my code my am duing everything the same >way but it still don't seems to be working I

Re: Unicode failure (Solved)

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain" wrote: >On Fri, 4 Dec 2015 18:28:22 -0500 >Terry Reedy wrote: >> Tk widgets, and hence IDLE windows, will print any character from >> \u to \u without raising, even if the result is blank or ?. >> Higher codepoints fail, but allowing the entire BMP is better than >> an

Re: Unicode failure

2015-12-06 Thread Dave Farrance
I was taking it for granted that you knew how to set environment variables, but just in case you don't: In the shell, (are you using BASH?), put this: export PYTHONIOENCODING=UTF-8 ...then run your script. Remember that this is *not* a permanent fix. -- https://mail.python.org/mailman/listinfo/

Re: Unicode failure

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain" wrote: >... >utf-8 >Traceback (most recent call last): > File "./g", line 5, in >print(u"\N{TRADE MARK SIGN}") >UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in >position 0: ordinal not in range(128) I *presume* that you're using Linux since you've go

Re: Object identity has no necessary connection to memory location (was: What is a function parameter =[] for?)

2015-11-26 Thread Dave Farrance
Ben Finney wrote: >Dave Farrance writes: > >> Marko Rauhamaa wrote: >> >> >Dave Farrance : >> > >> >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> >> unchanging ids, even after exiting PyPy and r

Re: What is a function parameter =[] for?

2015-11-26 Thread Dave Farrance
Marko Rauhamaa wrote: >Dave Farrance : > >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> unchanging ids, even after exiting PyPy and restarting, so it seems >> that PyPy's numerical ids are "faked".) > >What's a fake

Re: Help needed with compiling python

2015-11-26 Thread Dave Farrance
Cecil Westerhof wrote: >On Wednesday 25 Nov 2015 23:58 CET, Laura Creighton wrote: >> >> Your Suse system probably wants to use python for something. If your >> system python is damaged, you badly need to fix that, using the >> system package managers tools, before Suse does some sort of update >

Re: What is a function parameter =[] for?

2015-11-26 Thread Dave Farrance
Alan Bawden wrote: >Chris Angelico writes: > ... >> Python 2.7.8 (2.4.0+dfsg-3, Dec 20 2014, 13:30:46) >> [PyPy 2.4.0 with GCC 4.9.2] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> tuple([]) is tuple([]) >> False > >I said I wouldn't be suprised if it

Re: Is there any reason to introduce this intermediate variable (sz)?

2015-11-18 Thread Dave Farrance
fl wrote: >Hi, >I find the following code snippet, which is useful in my project: > ... >correctly. Could you see something useful with variable 'sz'? So that's example code in "An Introduction to the Kalman Filter" by Greg Welch and Gary Bishop, and no, that construct was unnecessary. As you've

Re: Problems using struct pack/unpack in files, and reading them.

2015-11-17 Thread Dave Farrance
Steven D'Aprano wrote: >On Mon, 16 Nov 2015 05:15 pm, Gregory Ewing wrote: > >> Ints are not the only thing that // can be applied to: >> >> >>> 1.0//0.01 >> 99.0 > >Good catch! Hmmm. I see that the float for 0.01 _is_ slightly larger than 0.01 >>> Decimal(0.01) Decimal('0.012

Re: What is '@' for

2015-11-14 Thread Dave Farrance
fl wrote: >I read the following code snippet. A question is here about '@'. >I don't find the answer online yet. I recommend this: "Understanding Python Decorators in 12 Easy Steps!" http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ -- https://mail.python.org/mailman/li

Re: don't understand matrix-multiplication should be reversed in python?

2015-11-13 Thread Dave Farrance
PythonDude wrote: >On Thursday, 12 November 2015 22:57:21 UTC+1, Robert Kern wrote: >> He simply instantiated the two vectors as row-vectors instead of >> column-vectors, >> which he could have easily done, so he had to flip the matrix expression. > >Thank you very much Robert - I just had to

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Dave Farrance
Random832 wrote: >The opposite of line buffering is not no buffering, but full >(i.e. block) buffering, that doesn't get flushed until it runs >out of space. TextIOWrapper has its own internal buffer, and its >design apparently doesn't contemplate the possibility of using >it with a raw FileIO ob

Re: python doesn't install

2015-11-02 Thread Dave Farrance
Tim Golden wrote: >I'm afraid you've been bitten by the fact that we no longer support >Windows XP and haven't communicated this very well. We have a new >version of the installer almost ready for release which indicates this >much earlier (and more obviously). I'm afraid if you're on XP you'r

Re: Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-07 Thread Dave Farrance
Rob Gaddi wrote: >So, this is odd. I'm running Ubuntu 14.04, and my system did a kernel >upgrade from the repository from 3.13.0-63-generic to 3.13.0-65-generic. >And pyserial (2.7, installed through pip) stopped working. When KDE's "Plasma 5" appeared with Kubuntu 15.04, I found it to be to

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 20:03:26 +0100, Dave Farrance writes: >>Laura Creighton wrote: >> >>>In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >>>>Yet the documentation says that it's mandatory for t

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >>Yet the documentation says that it's mandatory for the GUI backend base >>to implement stop() but that single_shot is optional. Ho hum. > >report as a bug. its a doc bug a

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 17:36:50 +0100, Dave Farrance writes: >>I'm trying to set up the basics of a timer-scheduled function in >>matplotlib and I can't figure out how to stop the timer. Maybe the >>stop() method is dysfunction

matplotlib timer

2015-10-01 Thread Dave Farrance
I'm trying to set up the basics of a timer-scheduled function in matplotlib and I can't figure out how to stop the timer. Maybe the stop() method is dysfunctional in Ubuntu 14.04 or maybe I'm getting the syntax wrong. If anybody's got matplotlib installed, can you try this code and tell me if it s

Re: pygame basic question

2015-09-08 Thread Dave Farrance
"ast" wrote: >DISPLAYSURF = pygame.display.set_mode((400, 300)) >pygame.display.set_caption('Hello World!') > >The first line opens a 400x300 pygame window. >The second one writes "Hello World" on top of it. > >I am just wondering how function set_caption finds the windows >since the window's nam

Re: "no module named kivy" import error in ubuntu 14.04

2015-08-16 Thread Dave Farrance
shiva upreti wrote: >Hi >I am new to linux. I tried various things in attempt to install kivy. I >installed python 2.7.10 Just to make clear what others have said -- replacing Ubuntu 14.04's system Python 2.7.6 is a bad idea and will break stuff, so if you really must have the latest version of

Re: I'm a newbie and I'm still stumped...

2015-08-03 Thread Dave Farrance
Dwight GoldWinde wrote: >Here are the results I got below, showing the same error. The first line >says, >"2.7.6 (default, Sep 9 2014, 15:04:36)”. Does that mean I am running the >old Python? How could that be since I am SURE I downloaded 3.4.3 (it even >gives the folder name as “Python 3.4” in

Re: How to Calculate NPV?

2015-07-30 Thread Dave Farrance
ryguy7272 wrote: >PERFECT!! SO SIMPLE!! >I don't know why the author didn't do that in the book. The book is evidently giving you code snippets to enter into Python's own interactive interpreter, i.e., you enter "python" at the command line, then you manually type each command which immediately

Re: How to construct matrix from vectors?

2015-06-21 Thread Dave Farrance
Fabien wrote: >another solution with less "(([[]]))", and less ";". There are way too >many ";" in Matlab ;) > >import numpy as np >v1 = [1, 2, 3] >v2 = [4, 5, 6] >v3 = [7, 8, 9] >v4 = [10, 11, 12] >np.hstack([[v1, v2], [v3, v4]]).T >Out[]: >array([[ 1, 4], >[ 2, 5], >[ 3, 6],

Re: Can Python function return multiple data?

2015-06-05 Thread Dave Farrance
Rustom Mody wrote: >On Saturday, June 6, 2015 at 10:20:49 AM UTC+5:30, Steven D'Aprano wrote: >> On Sat, 6 Jun 2015 01:20 pm, Rustom Mody wrote: >> > As a parallel here is Dijkstra making fun of AI-ers use of the word >> > 'intelligent' >> > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD0

Re: Zero [was Re: What is considered an "advanced" topic in Python?]

2015-06-01 Thread Dave Farrance
Skip Montanaro wrote: >P.S., Dave, your "omitthis" and "andthis" kind of sucks for the rest of us. >And I just invalidated your attempts at >obscurity by replying to your correct email address. I suggest you just >omit that stuff going forward. Unfortunately, >I now I have a crap address in my Gm

Re: Zero [was Re: What is considered an "advanced" topic in Python?]

2015-06-01 Thread Dave Farrance
Steven D'Aprano wrote: >On Mon, 1 Jun 2015 07:36 pm, Marko Rauhamaa wrote: > >> However, I constantly run into engineers who don't understand what >> zero means. > >Okay, I'll bite. > >What does zero mean, and how do engineers misunderstand it? There are two hard things in computer science: cach

Re: What is considered an "advanced" topic in Python?

2015-06-01 Thread Dave Farrance
Laura Creighton wrote: >If you are giving a talk about Decimal -- and trying to stamp out the >inappropriate use of floats you have to first inform people that >what they learned as 'decimals' as children was not floating point, >despite the fact that we write them the same way. ... To be fair,

Re: Minus operator versus unary minus

2015-05-30 Thread Dave Farrance
Peter Otten <__pete...@web.de> wrote: >so both +0.0 and -0.0 would be skipped anyway. Maybe the coder was simply aiming for visibility. The unary minus can be hard to spot in some circumstances. e.g.: I've sneaked a unary minus into this maths proof, which makes it horrible (although correct):

Re: Survey -- Move To Trash function in Python?

2015-05-14 Thread Dave Farrance
Steven D'Aprano wrote: >I'd like to do a little survey, and get a quick show of hands. > >How many people have written GUI or text-based applications or scripts where >a "Move file to trash" function would be useful? > >Would you like to see that in the standard library, even if it meant that >th

Re: Best GUI for Python

2015-04-28 Thread Dave Farrance
Christian Gollwitzer wrote: >Yes, the default theme is terrible on Linux (Mac & Windows uses native >widgets). There are additional themes available, which are buried in >some packages and a bit difficult to install, but give reasonable >approximations to the QT look; I'm talking about plastik

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Dave Farrance
Mario Figueiredo wrote: >Other than replacing the random module with the probability density >function for the exponential distribution, do you have a suggestion of >how I could smooth the curve? Moving average. Try: def movingaverage(interval, window_size): window= numpy.ones(int(window_si

Re: Python as shell

2015-04-22 Thread Dave Farrance
Cecil Westerhof wrote: >I am working again with Python and I am impressed again. ;-) > >I thought there was a Python shell that could be used instead of Bash >(or whichever shell you are using), but I can not find anything about >it. Am I wrong, or are my search engine skills so bad? You're prob

Re: Problem running Python 2.7 on Ubuntu 10.04

2015-04-20 Thread Dave Farrance
David Aldrich wrote: >Hi > >I wonder if someone could help me with this problem please? > >On an Ubuntu 10.04 platform, I want to run the latest version of Meld, which >is a Python program. > >Ubuntu 10.04 runs Python 2.6 as standard. Meld requires Python 2.7. So I >have installed Python 2.7

Re: find all multiplicands and multipliers for a number

2015-04-11 Thread Dave Farrance
$ python2 Python 2.7.8 (default, Oct 20 2014, 15:05:19) [GCC 4.9.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a = 256 >>> b = 256 >>> a is b True >>> a = 257 >>> b = 257 >>> a is b False >>> It's not safe to use 'is' to compare integers. Use == -- htt

Re: Newbie looking for elegant solution

2015-03-24 Thread Dave Farrance
otaksoftspamt...@gmail.com wrote: >I have a list containing 9600 integer elements - each integer is either 0 or 1. >Starting at the front of the list, I need to combine 8 list elements into 1 by >treating them as if they were bits of one byte with 1 and 0 denoting bit >on/off (the 8th element wo

Re: Python+Glade+Gtk tutorial?

2015-03-17 Thread Dave Farrance
Jason Heeris wrote: >In terms of toolkit bindings, (a) I prefer GTK, but (b) it's impossible to >tell what the greater proportion of people using one vs. the other is. Or >if they're wise to do so. Are there more Google hits/SO questions because >it's harder to use? Or because everyone loves to u

Python+Glade+Gtk tutorial?

2015-03-16 Thread Dave Farrance
In the past, I've used Visual-C++ for creating dialog-based interfaces for controlling equipment and displaying data, and I'm looking for something of similar ease-of-use in Python since that's now my preferred language. A web-search told me that Glade seems to be most peoples choice (over QT-Desig

Re: PSF news - BBC launches MicroBit

2015-03-15 Thread Dave Farrance
Mark Lawrence wrote: >http://pyfound.blogspot.co.uk/2015/03/bbc-launches-microbit.html may be >of interest to some of you. "Python is one of the three languages that work with the device." That's cool, and the article says that the Raspberry Pi Foundation is involved in creating learning conte

Re: Do not run this code.

2015-03-04 Thread Dave Farrance
Ben Finney wrote: >Chris Angelico writes: > >> import base64; exec(…) > >That's all I need to know. Code with ‘exec()’ calls, I consider unsafe >by default. Indeed. replacing exec with print... >>> print(base64.b64decode(b"eD0neD0lcjsgZXhlYyh4JSV4KSc7IGV4ZWMoeCV4KQ==")) x='x=%r; exec(x%%x)'; e

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Dave Cook wrote: >On 2015-02-22, Dave Farrance wrote: > >> It's still quicker to do a re-write in the more cumbersome C > >You should try Cython. I did try Cython when I was trying to figure out what to do about the slow speed. My initial attempt showed no speedup at

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Laura Creighton wrote: >Good news -- it seems to be working fine with PyPy. >https://travis-ci.org/hugovk/Pillow/builds > >for me, not extensively tested, it just seems to be working. > >I have several pypy's floating around here, each within its own >virtualenv. If you aren't familiar with vir

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Dave Farrance wrote: >Steven D'Aprano wrote: > >>I assume you're talking about drawing graphics rather than writing text. Can >>you tell us which specific library or libraries won't run under PyPy? > >Yes, mainly the graphics. I'm a hardware enginee

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Steven D'Aprano wrote: >I assume you're talking about drawing graphics rather than writing text. Can >you tell us which specific library or libraries won't run under PyPy? Yes, mainly the graphics. I'm a hardware engineer, not a software engineer, so I might well be misunderstanding PyPy's curr

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Laura Creighton wrote: >I don't understand 'an interpreter rather than a JIT'. PyPy has a >JIT, that sort of is the whole point. Yes. I meant that from my end-user, non-software-engineer perspective, it looked as though CPython was proceeding with leaps and bounds and that PyPy remained mostly

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
jkn wrote: > I'm curious what ...behavioural... models you are creating quickly in > Python that then need rewriting in C for speed. SPICE? some other CAD? > Might be interesting to learn more about what and how you are actually > doing. The convert-to-C cases were complex filtering functions.

Future of Pypy?

2015-02-22 Thread Dave Farrance
As an engineer, I can quickly knock together behavioural models of electronic circuits, complete units, and control systems in Python, then annoyingly in a few recent cases, have to re-write in C for speed. I've tried PyPy, the just-in-time compiler for Python, and that is impressively, hugely fa