Re: super or not super?

2019-07-14 Thread Paulo da Silva
Às 16:20 de 12/07/19, Rhodri James escreveu: > On 12/07/2019 15:12, Paulo da Silva wrote: > ... > super() also has major advantages if you are stuck with multiple > inheritance.  Raymond Hettinger has an excellent article on this here: > https://rhettinger.wordpress.com/2

Re: super or not super?

2019-07-16 Thread Paulo da Silva
Às 02:11 de 15/07/19, Chris Angelico escreveu: > On Mon, Jul 15, 2019 at 10:51 AM Paulo da Silva > wrote: >> ... >> >> Thank you Jollans. I forgot multiple inheritance. I never needed it in >> python, so far. >> > > Something to consider is that sup

Like c enumeration in python3

2020-03-22 Thread Paulo da Silva
Hi! Suppose a class C. I want something like this: class C: KA=0 KB=1 KC=1 ... Kn=n def __init__ ... ... These constants come from an enum in a .h (header of C file). They are many and may change from time to time. Is there a way

Re: Like c enumeration in python3 [ERRATA]

2020-03-22 Thread Paulo da Silva
Às 02:18 de 23/03/20, Paulo da Silva escreveu: > Hi! > > Suppose a class C. > I want something like this: > > class C: > KA=0 > KB=1 KC=2 > ... > Kn=n > > def __init__ ... > ... > > > These

Re: Like c enumeration in python3

2020-03-23 Thread Paulo da Silva
Thank you very much for all your responses! Now I have too much ideas :-) I'm saving your answers and I'll see what is more appropriate/comfortable in my case. Best regards. Paulo -- https://mail.python.org/mailman/listinfo/python-list

Problem exiting from a script using tkinter

2020-11-21 Thread Paulo da Silva
Hi! Why this does not work?! from tkinter import * def terminate(root): root.quit root=Tk() #b=Button(root,text="QUIT",command=root.quit) b=Button(root,text="QUIT",command=lambda: terminate(root)) b.pack() mainloop() Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem exiting from a script using tkinter

2020-11-21 Thread Paulo da Silva
Às 22:18 de 21/11/20, Chris Angelico escreveu: > On Sun, Nov 22, 2020 at 9:16 AM Paulo da Silva > wrote: >> >> Hi! >> >> Why this does not work?! >> >> from tkinter import * >> >> def terminate(root): >> root.quit >> > >

Re: Problem exiting from a script using tkinter

2020-11-25 Thread Paulo da Silva
Às 22:44 de 21/11/20, Chris Angelico escreveu: > On Sun, Nov 22, 2020 at 9:36 AM Paulo da Silva > wrote: >> >> Às 22:18 de 21/11/20, Chris Angelico escreveu: >>> On Sun, Nov 22, 2020 at 9:16 AM Paulo da Silva >>> wrote: >>>> >>>> H

Learning tkinter - a grid problem

2020-12-05 Thread Paulo da Silva
Hi! Why this example does not work? -- from tkinter import * root=Tk() root.geometry("400x200") S=Scrollbar(root) T=Text(root) T.grid(row=0,column=0) S.grid(row=0,column=1) S.config(command=T.yview) T.config(yscrollcommand=S.set) txt="""This is a very big text - - - - - - - - - -

Re: Learning tkinter - a grid problem

2020-12-05 Thread Paulo da Silva
Às 20:20 de 05/12/20, MRAB escreveu: > On 2020-12-05 18:56, Paulo da Silva wrote: >> Hi! >> >> Why this example does not work? >> > There are a few bits of configuration missing: > >> -- >> from tkinter import * >>

numpy/python (image) problem

2020-12-08 Thread Paulo da Silva
Hi! I am looking at some code, that I found somewhere in the internet, to compute DCT for each 8x8 block in an gray (2D) image (512x512). This is the code: def dct2(a): return scipy.fft.dct(scipy.fft.dct(a,axis=0,norm='ortho'),axis=1,norm='ortho') imsize=im.shape dct=np.zeros(imsize) # Do

Re: numpy/python (image) problem

2020-12-09 Thread Paulo da Silva
Às 05:55 de 09/12/20, Paulo da Silva escreveu: > Hi! > > I am looking at some code, that I found somewhere in the internet, to > compute DCT for each 8x8 block in an gray (2D) image (512x512). > > This is the code: > > def dct2(a): > return > scipy.fft.dct(scip

Class and tkinter problem

2021-01-06 Thread Paulo da Silva
Hi! Does anybody know why cmd method isn't called when I change the button state (clicking on it) in this example? I know that this seems a weird class use. But why doesn't it work? Thanks. class C: from tkinter import Checkbutton import tkinter @staticmethod def cmd(): p

Re: Class and tkinter problem

2021-01-07 Thread Paulo da Silva
Às 07:42 de 07/01/21, Christian Gollwitzer escreveu: > Am 07.01.21 um 08:29 schrieb Paulo da Silva: > >> Does anybody know why cmd method isn't called when I change the button >> state (clicking on it) in this example? >> I know that this seems a weird class

Re: Class and tkinter problem

2021-01-07 Thread Paulo da Silva
Às 09:20 de 07/01/21, Terry Reedy escreveu: > On 1/7/2021 2:42 AM, Christian Gollwitzer wrote: >> Am 07.01.21 um 08:29 schrieb Paulo da Silva: >> >>> Does anybody know why cmd method isn't called when I change the button >>> state (clicking on it) in this

Re: Class and tkinter problem

2021-01-07 Thread Paulo da Silva
Às 16:02 de 07/01/21, Peter Otten escreveu: > On 07/01/2021 08:42, Christian Gollwitzer wrote: >> Am 07.01.21 um 08:29 schrieb Paulo da Silva: >> ... > > I recommend that the OP use a more conventional stye and do the setup > outside the class or, better, in an instanc

Re: Class and tkinter problem

2021-01-07 Thread Paulo da Silva
Às 07:29 de 07/01/21, Paulo da Silva escreveu: > Hi! > > Does anybody know why cmd method isn't called when I change the button > state (clicking on it) in this example? > I know that this seems a weird class use. But why doesn't it work? > Thanks. > >

Re: Class and tkinter problem

2021-01-07 Thread Paulo da Silva
Às 20:35 de 07/01/21, Terry Reedy escreveu: > On 1/7/2021 4:20 AM, Terry Reedy wrote: >> On 1/7/2021 2:42 AM, Christian Gollwitzer wrote: >>> Am 07.01.21 um 08:29 schrieb Paulo da Silva: >>> >>>> Does anybody know why cmd method isn't called when I chan

Copy a file like unix cp -a --reflink

2013-12-18 Thread Paulo da Silva
Hi! Is there a way to copy a file the same as Unix command: cp -a --reflink src dest without invoking a shell command? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Hi! I am using a python3 script to produce a bash script from lots of filenames got using os.walk. I have a template string for each bash command in which I replace a special string with the filename and then write the command to the bash script file. Something like this: shf=open(bashfilename,

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Em 12-01-2014 16:23, Peter Otten escreveu: > Paulo da Silva wrote: > >> I am using a python3 script to produce a bash script from lots of >> filenames got using os.walk. >> >> I have a template string for each bash command in which I replace a >> special str

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
> > I think instead of the hard way sketched out above it will be sufficient to > specify the error handler when opening the destination file > > shf = open(bashfilename, 'w', errors="surrogateescape") This seems to fix everything! I tried with a small test set and it worked. > > but I have no

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-12 Thread Paulo da Silva
Em 12-01-2014 20:29, Peter Otten escreveu: > Paulo da Silva wrote: > >>> but I have not tried it myself. Also, some bytes may need to be escaped, >>> either to be understood by the shell, or to address security concerns: >>> >> >> Since I am puting

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Paulo da Silva
Em 13-01-2014 08:58, Peter Otten escreveu: > Peter Otten wrote: > >> Paulo da Silva wrote: >> >>> Em 12-01-2014 20:29, Peter Otten escreveu: >>>> Paulo da Silva wrote: >>>> >>>>>> but I have not tried it myself. Also, some byte

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Paulo da Silva
Em 13-01-2014 17:29, Peter Otten escreveu: > Paulo da Silva wrote: > >> Em 13-01-2014 08:58, Peter Otten escreveu: > > I looked around in the stdlib and found shlex.quote(). It uses ' instead of > " which simplifies things, and special-cases only ': &

Re: issues

2015-12-18 Thread Paulo da Silva
Às 22:44 de 04-12-2015, Anna Szaharcsuk escreveu: > Hello there, > > I was trying to install PyCharm, but didn't worked and needed interpreter. > the computer advised to install the python for windows. > I don't know PyCharm but it is likely it needs python. Did you install python? You may need

Re: Error

2015-12-27 Thread Paulo da Silva
I am not a windows user but googling for api-ms-win-crt-runtime-l1-1-0.dll I could find many pages on this subject. The 1st one was https://www.smartftp.com/support/kb/the-program-cant-start-because-api-ms-win-crt-runtime-l1-1-0dll-is-missing-f2702.html Search by yourself or use this one, for exa

Re: A newbie's doubt

2016-01-07 Thread Paulo da Silva
Às 03:20 de 07-01-2016, Henrique Correa escreveu: > Is Python's Tutorial (by Guido) a good and complete reference for the > language? Good yes. Complete no. I mean, after reading it, should I have a good basis on Python? Yes if you know how to program on another language. > HTH Paulo -- https

virtualenv: help me decide

2016-01-14 Thread Paulo da Silva
Hi all! I am about to install tensorflow and I am considering to use virtualenv. Unfortunately I don't know anything about this. So, a couple of questions before I dig more ... 1. Are all already installed python stuff visible inside virtualenv? 2. I used to use eclipse for development. Is it usab

Re: virtualenv: help me decide

2016-01-15 Thread Paulo da Silva
Às 05:10 de 15-01-2016, Cameron Simpson escreveu: > On 15Jan2016 03:37, Paulo da Silva wrote: ... > Virtualenv is so easy to use that i suggest you > just try it and see. > Thank you very much Cameron. Being easy, I'll give it a try with a small test program and see how

Same function but different names with different set of default arguments

2016-01-20 Thread Paulo da Silva
Hi all. What is the fastest implementation of the following code? def g(p): ... return something def f1(p="p1"): return g(p) def f2(p="p2"): return g(p) Thanks Paulo -- https://mail.python.org/mailman/listinfo/python-list

Re: Same function but different names with different set of default arguments

2016-01-23 Thread Paulo da Silva
Às 07:30 de 21-01-2016, Paulo da Silva escreveu: > Hi all. > > What is the fastest implementation of the following code? > > def g(p): > ... > return something > > def f1(p="p1"): > return g(p) > > def f2(p="p2"): >

ts.plot() pandas: No plot!

2016-01-31 Thread Paulo da Silva
Hi! I am learning pandas and following the tutorial I tried the following: ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000)) ts = ts.cumsum() ts.plot() No plot is produced! Only the following output: Any clue on what is happening? I'm using kubuntu and python

Re: ts.plot() pandas: No plot!

2016-01-31 Thread Paulo da Silva
Às 01:43 de 01-02-2016, Mark Lawrence escreveu: > On 01/02/2016 00:46, Paulo da Silva wrote: ... >> > > Is it as simple as adding a call to ts.show() ? > Thanks for the clue! Not so simple however. Needed to do import matplotlib.pyplot as plt plt.show() Thank you :-

Re: ts.plot() pandas: No plot!

2016-01-31 Thread Paulo da Silva
Às 01:15 de 01-02-2016, Chris Angelico escreveu: > On Mon, Feb 1, 2016 at 11:46 AM, Paulo da Silva > wrote: ... > > Hmm. Normally I would expect matplotlib to pop up a graph there. Are > you running this from a terminal, or from some sort of GUI? It might > make a difference t

Re: ts.plot() pandas: No plot!

2016-02-01 Thread Paulo da Silva
Às 14:18 de 01-02-2016, Jason Swails escreveu: > On Sun, Jan 31, 2016 at 9:08 PM, Paulo da Silva < > p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote: > >> Às 01:43 de 01-02-2016, Mark Lawrence escreveu: >>> On 01/02/2016 00:46, Paulo da Silva wrote: ... > > ​W

A sets algorithm

2016-02-07 Thread Paulo da Silva
Hello! This may not be a strict python question, but ... Suppose I have already a class MyFile that has an efficient method (or operator) to compare two MyFile s for equality. What is the most efficient way to obtain all sets of equal files (of course each set must have more than one file - all

Re: A sets algorithm

2016-02-07 Thread Paulo da Silva
Às 22:17 de 07-02-2016, Tim Chase escreveu: > On 2016-02-07 21:46, Paulo da Silva wrote: ... > > If you the MyFile objects can be unique but compare for equality > (e.g. two files on the file-system that have the same SHA1 hash, but > you want to know the file-names), you'd

Re: A sets algorithm

2016-02-07 Thread Paulo da Silva
Às 21:46 de 07-02-2016, Paulo da Silva escreveu: > Hello! > > This may not be a strict python question, but ... > > Suppose I have already a class MyFile that has an efficient method (or > operator) to compare two MyFile s for equality. > > What is the most efficient w

Storing a big amount of path names

2016-02-11 Thread Paulo da Silva
Hi! What is the best (shortest memory usage) way to store lots of pathnames in memory where: 1. Path names are pathname=(dirname,filename) 2. There many different dirnames but much less than pathnames 3. dirnames have in general many chars The idea is to share the common dirnames. More realisti

Re: Storing a big amount of path names

2016-02-11 Thread Paulo da Silva
Às 03:49 de 12-02-2016, Chris Angelico escreveu: > On Fri, Feb 12, 2016 at 2:13 PM, MRAB wrote: >> Apart from all of the other answers that have been given: >> ... > > Simpler to let the language do that for you: > import sys p1 = sys.intern('foo/bar') p2 = sys.intern('foo/bar') >

Re: Storing a big amount of path names

2016-02-11 Thread Paulo da Silva
Às 04:23 de 12-02-2016, Chris Angelico escreveu: > On Fri, Feb 12, 2016 at 3:15 PM, Paulo da Silva > wrote: >> Às 03:49 de 12-02-2016, Chris Angelico escreveu: >>> On Fri, Feb 12, 2016 at 2:13 PM, MRAB wrote: >>>> Apart from all of the o

Re: Storing a big amount of path names

2016-02-11 Thread Paulo da Silva
Às 05:02 de 12-02-2016, Chris Angelico escreveu: > On Fri, Feb 12, 2016 at 3:45 PM, Paulo da Silva > wrote: ... >> I think a dict, as MRAB suggested, is needed. >> At the end of the store process I may delete the dict. > > I'm not 100% sure of what's going o

What is heating the memory here? hashlib?

2016-02-13 Thread Paulo da Silva
Hello all. I'm running in a very strange (for me at least) problem. def getHash(self): bfsz=File.blksz h=hashlib.sha256() hu=h.update with open(self.getPath(),'rb') as f: f.seek(File.hdrsz) # Skip

Re: What is heating the memory here? hashlib?

2016-02-13 Thread Paulo da Silva
I meant eating! :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: What is heating the memory here? hashlib?

2016-02-13 Thread Paulo da Silva
Às 22:45 de 13-02-2016, Chris Angelico escreveu: > On Sun, Feb 14, 2016 at 9:26 AM, Paulo da Silva > wrote: >> I meant eating! :-) > > Heh, "heating" works too - the more you use memory, the more it heats up :) :-) It is heating my head! ... > > What happen

Re: What is heating the memory here? hashlib?

2016-02-13 Thread Paulo da Silva
I was unable to reproduce the situation using a simple program just walking through all files>4K, with or without the seek, and computing their shasums. Only some fluctuations of about 500MB in memory consumption. I'll look at this when I get more time, taking in consideration the suggestions here

Re: What is heating the memory here? hashlib?

2016-02-14 Thread Paulo da Silva
Às 07:04 de 14-02-2016, Paulo da Silva escreveu: > I was unable to reproduce the situation using a simple program just > walking through all files>4K, with or without the seek, and computing > their shasums. > Only some fluctuations of about 500MB in memory consumption. Today I g

Re: What is heating the memory here? hashlib?

2016-02-14 Thread Paulo da Silva
Às 09:49 de 14-02-2016, INADA Naoki escreveu: > tracemalloc module may help you to investigate leaks. > 2016/02/14 午後4:05 "Paulo da Silva" : > Thanks. I didn't know it! Paulo -- https://mail.python.org/mailman/listinfo/python-list

Re: What is heating the memory here? hashlib?

2016-02-15 Thread Paulo da Silva
Às 02:21 de 14-02-2016, Steven D'Aprano escreveu: > On Sun, 14 Feb 2016 06:29 am, Paulo da Silva wrote: ... Thanks Steven for your advices. This is a small script to solve a specific problem. It will be used in future to solve other similar problems probably with small changes. When I

Re: What is heating the memory here? hashlib?

2016-02-15 Thread Paulo da Silva
Às 08:12 de 15-02-2016, Johannes Bauer escreveu: > On 15.02.2016 03:21, Paulo da Silva wrote: > >> So far I tried the program twice and it ran perfectly. > > I think you measured your RAM consumption wrong. > > Linux uses all free RAM as HDD cache. That's what is

Python3: Reading a text/binary mixed file

2015-03-09 Thread Paulo da Silva
Hi! What is the best way to read a file that begins with some few text lines and whose rest is a binary stream? As an exmaple ... files .pnm. Thanks for any comments/help on this. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3: Reading a text/binary mixed file

2015-03-09 Thread Paulo da Silva
On 10-03-2015 00:55, Dave Angel wrote: > On 03/09/2015 08:45 PM, Paulo da Silva wrote: >> Hi! >> >> What is the best way to read a file that begins with some few text lines >> and whose rest is a binary stream? >> ... > > In which version of Python? there&

Re: Python3: Reading a text/binary mixed file

2015-03-09 Thread Paulo da Silva
On 10-03-2015 00:56, Chris Angelico wrote: > On Tue, Mar 10, 2015 at 11:45 AM, Paulo da Silva > wrote: >> Hi! >> ... > Read the entire file in binary mode, and figure out which parts are > text and how they're encoded (possibly ASCII or UTF-8). Then take just >

Re: Python3: Reading a text/binary mixed file

2015-03-10 Thread Paulo da Silva
On 10-03-2015 04:14, Cameron Simpson wrote: > On 10Mar2015 04:01, Paulo da Silva wrote: >> On 10-03-2015 00:55, Dave Angel wrote: ... >> For .pnm photo files I read the entire file (I needed it in memory >> anyway), splited a copy separated by b'\n', got the hea

Re: Python3: Reading a text/binary mixed file

2015-03-10 Thread Paulo da Silva
On 10-03-2015 12:41, random...@fastmail.us wrote: > On Tue, Mar 10, 2015, at 00:01, Paulo da Silva wrote: >> For .pnm photo files I read the entire file (I needed it in memory >> anyway), splited a copy separated by b'\n', got the headers stuff and >> then used the

Re: Python3: Reading a text/binary mixed file

2015-03-10 Thread Paulo da Silva
On 10-03-2015 05:56, Steven D'Aprano wrote: ... Thank you very much for your post. I learned what I'm needing from it! Exactly what I was looking for. Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3: Reading a text/binary mixed file

2015-03-12 Thread Paulo da Silva
On 11-03-2015 01:09, Cameron Simpson wrote: > On 10Mar2015 22:38, Paulo da Silva wrote: >> On 10-03-2015 04:14, Cameron Simpson wrote: ... > > Since binary files (returning bytes from reads) also have a convenient > readline method looking for byte 10 ('\n')

A question about numpy

2015-04-14 Thread Paulo da Silva
I am new to numpy ... Supposing I have 2 vectors v1 and v2 and a value (constant) k. I want to build a vector r with all values of v1 greater than k and the others from v2. I found 2 ways, but not sure if they are the best solution: 1. r1=v1.copy() r2=v2.copy() r1[r1=k]=0 r=r1+r2 2. r=v1*(v1>=k

Re: A question about numpy

2015-04-14 Thread Paulo da Silva
On 14-04-2015 23:49, Rob Gaddi wrote: > On Tue, 14 Apr 2015 23:41:56 +0100, Paulo da Silva wrote: > >> Supposing I have 2 vectors v1 and v2 and a value (constant) k. >> I want to build a vector r with all values of v1 greater than k and the >> others from v2. &g

multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-20 Thread Paulo da Silva
I have program that generates about 100 relatively complex graphics and writes then to a pdf book. It takes a while! Is there any possibility of using multiprocessing to build the graphics and then use several calls to savefig(), i.e. some kind of graphic's objects? Thanks for any help/comments. -

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Paulo da Silva
On 21-04-2015 11:26, Dave Angel wrote: > On 04/20/2015 10:14 PM, Paulo da Silva wrote: >> I have program that generates about 100 relatively complex graphics and >> writes then to a pdf book. >> It takes a while! >> Is there any possibility of using multiprocessing t

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Paulo da Silva
On 21-04-2015 16:58, Chris Angelico wrote: > On Wed, Apr 22, 2015 at 1:53 AM, Paulo da Silva > wrote: >> Yes, I have 8 cores and the graphics' processes calculation are all >> independent. The problem I have is that if there is any way to generate >> independent fig

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-22 Thread Paulo da Silva
On 21-04-2015 03:14, Paulo da Silva wrote: > I have program that generates about 100 relatively complex graphics and > writes then to a pdf book. > It takes a while! > Is there any possibility of using multiprocessing to build the graphics > and then use several calls to savefig(),

pypy3 kubuntu 14.04

2015-04-25 Thread Paulo da Silva
Is there anybody using pypy3 in *ubuntu 14.04? I installed ppa:pypy/ppa but I still cannot see any pypy3! All refs to pypy (using aptitude) show in the comments python 2.7! Thanks for any help. -- https://mail.python.org/mailman/listinfo/python-list

Re: pypy3 kubuntu 14.04

2015-04-27 Thread Paulo da Silva
On 26-04-2015 05:09, Paulo da Silva wrote: > Is there anybody using pypy3 in *ubuntu 14.04? > > I installed ppa:pypy/ppa but I still cannot see any pypy3! > All refs to pypy (using aptitude) show in the comments python 2.7! > > Thanks for any help. > For those who may be i

Passing new fields to an object

2015-06-12 Thread Paulo da Silva
I would like to do something like this: class C: def __init__(self,**parms): ... c=C(f1=1,f2=None) I want to have, for the object self.f1=1 self.f2=None for an arbitrary number of parameters. What is the best way to achieve this? Thanks -- https://mail.python

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 17:17, gst wrote: > Le vendredi 12 juin 2015 11:53:24 UTC-4, Paulo da Silva a écrit : > in the __init__, simply do: > > self.__dict__.update(**parms) > > regards, > Ok. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 17:17, Peter Otten wrote: > Paulo da Silva wrote: > ... > >>>> import types >>>> class C(types.SimpleNamespace): > ... pass > ... >>>> c = C(f1=1, f2=None) >>>> c > C(f1=1, f2=None) > Thanks for all your e

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 12-06-2015 20:12, Peter Otten wrote: > Paulo da Silva wrote: > >> On 12-06-2015 17:17, Peter Otten wrote: >>> Paulo da Silva wrote: >>> >> ... ... > It *is* a class, and by making C a subclass of SimpleNamespace C inherits > the initialiser which doe

Re: Passing new fields to an object

2015-06-12 Thread Paulo da Silva
On 13-06-2015 02:25, Steven D'Aprano wrote: > On Fri, 12 Jun 2015 16:53:08 +0100, Paulo da Silva wrote: > ... > > You should use SimpleNamespace, as Peter suggests, but *not* subclass it. > If you subclass it and add methods: > > class C(SimpleNamespace

Which GUI?

2015-07-24 Thread Paulo da Silva
Hi all! I am about to write an application (python3 in linux) that needs: 1. Display time series graphics dynamically changed as the application runs, i.e. the graphics should reflect some internal variables states. 2. The same but for some network like diagrams. Basically nodes and connections

Re: Which GUI?

2015-07-26 Thread Paulo da Silva
On 26-07-2015 05:47, blue wrote: > Hi . > I tested all. Now I think the PySide can more. No python3! Besides ... any differences to pyqt4? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Which GUI?

2015-07-29 Thread Paulo da Silva
On 24-07-2015 19:31, Paulo da Silva wrote: I'll begin with pyqtgraph. Seems to be simple to start with. Thanks Chistopher. Later I'll give a try to bokeh. I'll need to look better at web applications first. I still don't know if dynamically changing is possible without the

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

2015-08-01 Thread Paulo da Silva
On 31-07-2015 02:22, Dwight GoldWinde wrote: > Please help. > > I am running Python 3.4 on my Mac mini, OS X 10.10.2, using Coderunner 2 > as my editor. > > Here’s the code: > #!/usr/bin/env python3 > word = (input('Enter a word ‘)) As is here, this code should raise a syntax error message like

Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Hi! I took a look at tkinter. It is pretty simple but it's very hard to construct some relatively more complex widgets. So I looked at pmw. Because my system only have pmw for python2, I downloaded pmw2 from its site and installed it manually using pysetup.py install. Trying the examples ...: So

Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:20 de 06-09-2015, Michael Torrie escreveu: > On 09/06/2015 12:47 PM, Paulo da Silva wrote: >> Do I need to go to more complex system like wxwidgets or pyside (QT)? >> I looked at the last one but, from the 1st steps, it seems too complex. > > Before anyone can sugges

Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:27 de 06-09-2015, Laura Creighton escreveu: > In a message of Sun, 06 Sep 2015 19:47:25 +0100, Paulo da Silva writes: >> Hi! >> ... > > Did you get it from PyPI? > https://pypi.python.org/pypi/Pmw/2.0.0 ? I got it from sourceforge but I checked now and it has th

Re: Trying pmw with python3: Lots of crashes!

2015-09-07 Thread Paulo da Silva
Às 06:24 de 07-09-2015, Christian Gollwitzer escreveu: > Am 07.09.15 um 03:40 schrieb Paulo da Silva: ... >> > For a multicolumn editable list I suggest using tablelist. There are > Python bindings around. Scrolling in Tk is generally done by grouping > together scrollbars and

kivy editable multicolumn list

2015-09-14 Thread Paulo da Silva
Hi all. Not sure if this is the place to ask about kivy ... I apologize if not. I am playing with the example here https://gist.github.com/geojeff/4442405 Now I would like to change the background color the editable field. So I added def __init__(self,**kwargs): super(Edi

Re: kivy editable multicolumn list

2015-09-16 Thread Paulo da Silva
Às 08:44 de 15-09-2015, David Aldrich escreveu: >> Not sure if this is the place to ask about kivy ... > > Try the kivy users list here: > > https://groups.google.com/forum/#!forum/kivy-users Thanks for the link. -- https://mail.python.org/mailman/listinfo/python-list

Re: kivy editable multicolumn list

2015-09-16 Thread Paulo da Silva
Às 11:42 de 15-09-2015, Laura Creighton escreveu: > In a message of Tue, 15 Sep 2015 03:31:49 +0100, Paulo da Silva writes: ... >> Now I would like to change the background color the editable field. >> ... > > I just hardcoded it like this: > > integers_dic

Generating a vector from successive multiplications of another vector from an initial value

2015-10-01 Thread Paulo da Silva
Hi all. What is the fastest way to do the following: I have an initial value V and a vector vec of (financial) indexes. I want to generate a new vector nvec as V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ... A numpy vectorized solution would be better. Thanks -- https://mail.python.

Re: Generating a vector from successive multiplications of another vector from an initial value

2015-10-01 Thread Paulo da Silva
Às 23:36 de 01-10-2015, Oscar Benjamin escreveu: > > On Thu, 1 Oct 2015 21:51 Paulo da Silva <mailto:p_s_d_a_s_i_l_v_a...@netcabo.pt>> wrote: ... > > V * np.cumprod(vec) > Thank you very much Oscar and Duncan. I googled a lot for such a function. Unfortunately the

Generating sin/square waves sound

2011-12-29 Thread Paulo da Silva
Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in python? Thanks for any answers/suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 30-12-2011 10:05, Dave Angel escreveu: > On 12/30/2011 02:17 AM, Paulo da Silva wrote: >> Hi, >> Sorry if this is a FAQ, but I have googled and didn't find any >> satisfatory answer. >> >> Is there a simple way, preferably multiplataform (or linux), of

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 30-12-2011 11:23, mblume escreveu: > Am Fri, 30 Dec 2011 07:17:13 + schrieb Paulo da Silva: ... > Alternatively you might just generate (t,signal) samples, write them to > a file and convert them using "sox" (under Linux, might also be available > under Windows) to

Re: Generating sin/square waves sound

2012-01-01 Thread Paulo da Silva
Em 31-12-2011 01:19, K Richard Pixley escreveu: > On 12/29/11 23:17 , Paulo da Silva wrote: >> Hi, >> Sorry if this is a FAQ, but I have googled and didn't find any >> satisfatory answer. >> >> Is there a simple way, preferably multiplataform (or linux), of

Re: Generating sin/square waves sound

2012-01-02 Thread Paulo da Silva
Em 30-12-2011 07:17, Paulo da Silva escreveu: > Hi, > Sorry if this is a FAQ, but I have googled and didn't find any > satisfatory answer. > > Is there a simple way, preferably multiplataform (or linux), of > generating sinusoidal/square waves sound in python? >

Where to "import"?

2007-03-08 Thread Paulo da Silva
Hi! If I have two files .py such as m.py from c import * ... x=c() ... os.any_method ... ... c.py class c: def __init__(self, ...): ... os.any_method ...

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Paulo da Silva escreveu: This is to thank all the answers I got so far. Now I understand perfectly how "import" works. Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Paulo da Silva escreveu: This is to thank all the answers I got so far. Now I understand perfectly how "import" works. Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to "import"?

2007-03-08 Thread Paulo da Silva
Bruno Desthuilliers escreveu: > Paulo da Silva a écrit : ... >> >> c.py >> class c: > class C(object): > > 1/ better to stick to naming conventions (class names in CamelCase) Ok. Thanks. > 2/ do yourself a favor: use new-style classes I still have

bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Hi! What is the best way to have something like the bisect_left method on a list of lists being the comparision based on an specified arbitrary i_th element of each list element? Is there, for lists, something equivalent to the __cmp__ function for classes? Thanks. -- http://mail.python.org/mai

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: ... > > lists *are* classes (at least since Python 2.2) > Inherit from the builtin list, redefine __cmp__(self, other) as ... Thanks Gabriel. This sounds very n

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: ... > Just omit the __init__ method, if you don't have anything additional to > do. The inherited method will be used instead, as always: Then, if I have something additional, I can do def __init__(self,l=None): if l!=None:

Re: number generator

2007-03-10 Thread Paulo da Silva
cesco escreveu: > I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simple pattern or function in Python to accomplish that? > > Than

Re: number generator

2007-03-10 Thread Paulo da Silva
Paul Rubin escreveu: > Paulo da Silva <[EMAIL PROTECTED]> writes: >> May be this is what you want ... >> I didn't test it enough ... but seems fine. > > That's way too complicated. Think about Gerald Flanagan's description > of the telegraph poles, an

Re: New to Python

2007-03-12 Thread Paulo da Silva
Alberto Vieira Ferreira Monteiro escreveu: > Hi, I am new to Python, how stupid can be the questions I ask? > > For example, how can I add (mathematically) two tuples? > x = (1,2) > y = (3,4) > How can I get z = (1 + 3, 2 + 4) ? > > Alberto Monteiro I think that what you want is numpy. I don't k

Request for a change in the csv module.

2007-03-12 Thread Paulo da Silva
Hi. I have just seen that csv module, more exactly the Dialect class, does not have any variable to specify the "floating point" character! In portuguese this is ','. Not '.'. 3.1415 -> 3,1415. I think this is also the case of other languages/countries. If I am correct, i.e. if there is no such po

<    1   2   3   >