Re: Best way to determine user's screensize?

2020-10-30 Thread jfong
What's wrong the OP's question? Why can't just answer it? --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: GUI (tkinter) popularity and job prospects for

2020-10-22 Thread jfong
Lammie Jonson於 2020年10月23日星期五 UTC+8上午5時20分45秒寫道: > Thanks, > > Yes, I have some sense about how to do job interviews and market myself > which is always an ongoing process. > > I also just have an interest in different technologies that I may want to > investigate as I can get bored with

Re: Any timeline for PIL for Python 3.4

2020-08-10 Thread jfong
dn於 2020年8月11日星期二 UTC+8下午1時29分47秒寫道: > On 11/08/2020 16:35, Martin wrote: > > I am running Python 3.4.4, and would like to > > use the Python Imaging Library (PIL).  This > > is currently not available for Python > > Version 3.  Does anybody know when it will > > become available? > > > > Plan B

Re: Function to avoid a global variable

2020-04-27 Thread jfong
bvdp於 2020年4月28日星期二 UTC+8上午9時46分35秒寫道: > Oh my, that is very cool! So, I can do this: > > def foo(i): > if not 'bar' in foo.__dict__: > foo.bar = 5 > foo.bar += i You can have function attribute created this way if you like: def foo(i): foo.bar += i foo.bar = 5

Re: Tkinter layout designer

2020-02-25 Thread jfong
mm0fmf於 2020年2月25日星期二 UTC+8上午5時29分33秒寫道: > Can anyone recommend a graphic layout designer for Tkinter programs. I > have a number of older C# Windows Forms apps that need porting so they > can run on Linux and Windows and this is the chance to re-write them in > Python. However, after using the

How to decide which module is in charge of this error? cx-Freeze or pynput or six?

2020-01-09 Thread jfong
le warning: ... Missing modules: ... ? six.moves imported from pynput._util ... Run the created hello.exe will cause this error: ... from pynput._util import Events File "C:\Users\jfong\AppData\Local\Programs\Python\Python36-32\lib\site- packages\pynput\_util\__init

Re: Does the argparse generate a wrong help message?

2020-01-01 Thread jfong
Random832於 2020年1月2日星期四 UTC+8上午5時04分36秒寫道: > On Fri, Dec 27, 2019, at 23:08, jf...@ms4.hinet.net wrote: > > > > optional arguments: > > > > -h, --help show this help message and exit > > > > --foo [FOO] foo help > > > > --goo GOOgoo help > > > > > > > > D:\Works\Python>py test.py

Re: Does the argparse generate a wrong help message?

2019-12-27 Thread jfong
Chris Angelico於 2019年12月28日星期六 UTC+8上午11時30分47秒寫道: > On Sat, Dec 28, 2019 at 2:26 PM wrote: > > > > The codes in test.py are: > > - > > import argparse > > parser = argparse.ArgumentParser() > > parser.add_argument('--foo', nargs='?', help='foo help') > > parser.add_argument('--goo',

Does the argparse generate a wrong help message?

2019-12-27 Thread jfong
The codes in test.py are: - import argparse parser = argparse.ArgumentParser() parser.add_argument('--foo', nargs='?', help='foo help') parser.add_argument('--goo', nargs=1, help='goo help') args = parser.parse_args() print(args.foo, args.goo) - But I get the following result:

Re: python 2 to 3 converter

2019-12-08 Thread jfong
Greg Ewing於 2019年12月9日星期一 UTC+8上午6時18分32秒寫道: > On 8/12/19 9:30 pm, songbird wrote: > >wouldn't it make more sense to just go back and fix the > > converter program than to have to manually convert all this > > python2 code? > > Anything that isn't already fixed by 2to3 is probably > somewhere

Re: How execute at least two python files at once when imported?

2019-11-06 Thread jfong
Igor Korot於 2019年11月7日星期四 UTC+8上午12時34分35秒寫道: > Hi, > > On Wed, Nov 6, 2019 at 10:22 AM Spencer Du wrote: > > > > Hi > > > > Sorry if I haven't stated my requirements clearly. > > > > I just wanted a way to import at least two python files in parallel and I > > wanted to know how this can be

Re: What's the difference between running a script under command box and interpreter?

2019-11-04 Thread jfong
Grant Edwards於 2019年11月5日星期二 UTC+8上午12時41分24秒寫道: > On 2019-11-04, Dennis Lee Bieber wrote: > > Using > > > >from module import * > > > > is often the worst thing one can do. > > I agree 100%. > > Unfortunately, most of the official standard library documentation is > written assuming you do

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
Chris Angelico於 2019年11月4日星期一 UTC+8上午10時19分50秒寫道: > On Mon, Nov 4, 2019 at 1:01 PM wrote: > > > > Chris Angelico於 2019年11月4日星期一 UTC+8上午8時43分07秒寫道: > > > Ah, that's a fair point. If you specifically WANT that behaviour, what > > > you can do is invoke the script interactively: > > > > > > python3

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
Chris Angelico於 2019年11月4日星期一 UTC+8上午8時43分07秒寫道: > On Mon, Nov 4, 2019 at 11:36 AM wrote: > > > > Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: > > > On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > > > > The globals are your current module's namespace, and functions defines > > >

Re: What's the difference between running a script under command box and interpreter?

2019-11-03 Thread jfong
Peter J. Holzer於 2019年11月4日星期一 UTC+8上午3時59分36秒寫道: > On 2019-11-01 04:24:38 -0700, jf...@ms4.hinet.net wrote: > > > The globals are your current module's namespace, and functions defines > > > in a module are bound to that module's namespace. > > > > > > Strip your test.py back. A lot. Try this:

Re: What's the difference between running a script under command box and interpreter?

2019-11-01 Thread jfong
Cameron Simpson於 2019年11月1日星期五 UTC+8下午5時28分42秒寫道: > On 31Oct2019 22:03, Jach Fong wrote: > >Cameron Simpson於 2019年11月1日星期五 UTC+8下午12時13分45秒寫道: > >> On 31Oct2019 20:44, Jach Fong wrote: > >> >The script test.py is something like this: > >> >---test.py > >> >from pyeds import fsm > >> >... >

Re: What's the difference between running a script under command box and interpreter?

2019-10-31 Thread jfong
Cameron Simpson於 2019年11月1日星期五 UTC+8下午12時13分45秒寫道: > On 31Oct2019 20:44, Jach Fong wrote: > >The script test.py is something like this: > >---test.py > >from pyeds import fsm > >... > >... > >class Rule_Parse: > >def __init__(self): > >... > >self.current_char = '' > >...

What's the difference between running a script under command box and interpreter?

2019-10-31 Thread jfong
The script test.py is something like this: ---test.py from pyeds import fsm ... ... class Rule_Parse: def __init__(self): ... self.current_char = '' ... ... def main(input_str): for c in input_str: ... rule.current_char = c ... if __name__ ==

Re: What's the purpose the hook method showing in a class definition?

2019-10-20 Thread jfong
Ian Hobson於 2019年10月20日星期日 UTC+8下午6時05分11秒寫道: > Hi Jach, > > On 20/10/2019 09:34, jf...@ms4.hinet.net wrote: > > What puzzles me is how a parent's method foo() can find its child's method > > goo(), no matter it was overwrote or not? MRO won't explain this and I > > can't find document about it

Re: What's the purpose the hook method showing in a class definition?

2019-10-20 Thread jfong
Sibylle Koczian於 2019年10月20日星期日 UTC+8上午2時04分54秒寫道: > Am 19.10.2019 um 13:11 schrieb jf...@ms4.hinet.net: > > For the two examples below: > > (1) > class A: > > ... def foo(self): > > ... self.goo() > > ... > class B(A): > > ... def goo(self): > > ... print(1) > >

What's the purpose the hook method showing in a class definition?

2019-10-19 Thread jfong
For the two examples below: (1) >>> class A: ... def foo(self): ... self.goo() ... >>> class B(A): ... def goo(self): ... print(1) ... (2) >>> class A: ... def foo(self): ... self.goo() ... def goo(self): pass ... >>> class B(A): ... def goo(self): ...

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread jfong
jf...@ms4.hinet.net於 2019年10月8日星期二 UTC+8上午10時45分36秒寫道: > For example: > from my-dir import test > > I know it can be solved by renaming, but any alternative? > > --Jach Maybe another (better?) solution is: import sys sys.path.append(r'my-dir') import test --Jach --

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread jfong
dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道: > jf...@ms4.hinet.net writes: > > ... > > But most of the download from Github has a directory named '-master' > > which causes a trouble sometimes. > > Those are likely not meant to be imported directly. > > Typically, you have a "setup" step which

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread jfong
DL Neil於 2019年10月8日星期二 UTC+8上午11時02分20秒寫道: > On 8/10/19 3:45 PM, jf...@ms4.hinet.net wrote: > > For example: > > from my-dir import test > > > > I know it can be solved by renaming, but any alternative? > > > The manual is your friend: > - import > - importlib > > (the latter allows modules to

How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread jfong
For example: from my-dir import test I know it can be solved by renaming, but any alternative? --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: exec and globals and locals ...

2019-09-20 Thread jfong
Peter Otten於 2019年9月20日星期五 UTC+8下午3時31分48秒寫道: > jf...@ms4.hinet.net wrote: > > x = 3 > def foo(): > > ... exec("print(globals(), locals()); x = x + 1; print(globals(), > > locals())") ... > foo() > > {'foo': , '__package__': None, '__builtins__': > > {, '__loader__': >

Re: exec and globals and locals ...

2019-09-19 Thread jfong
>>> x = 3 >>> def foo(): ... exec("print(globals(), locals()); x = x + 1; print(globals(), locals())") ... >>> foo() {'foo': , '__package__': None, '__builtins__': , '__loader__': , '__doc__': None, '__name__': '__main__', '__spec__': None, 'x': 3} {} {'foo': , '__package__': None,

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-10 Thread jfong
Terry Reedy於 2019年9月10日星期二 UTC+8下午5時16分19秒寫道: > On 9/10/2019 12:02 AM, jf...@ms4.hinet.net wrote: > > > Got it. The first Tk object is always the default one no matter where it > > was created. The default one is always the one which the widget > > constructor refer to when required. > > Or

Re: How to correctly use 'in_' argument in tkinter grid()?

2019-09-10 Thread jfong
Peter Otten於 2019年9月10日星期二 UTC+8下午5時04分27秒寫道: > jf...@ms4.hinet.net wrote: > > > I had tried the following script test.py: > > > > import tkinter as tk > > > > class Demo(tk.Frame): > > def __init__(self): > > tk.Frame.__init__(self, name='demo') > > self.pack() > >

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-09 Thread jfong
Terry Reedy於 2019年9月10日星期二 UTC+8上午11時43分05秒寫道: > On 9/9/2019 8:30 PM, jf...@ms4.hinet.net wrote: > > Terry Reedy於 2019年9月9日星期一 UTC+8下午3時06分27秒寫道: > > >> There will only be one default Tk object, but there can be multiple Tk > >> objects. > > import tkinter as tk > f0 = tk.Frame() > >

How to correctly use 'in_' argument in tkinter grid()?

2019-09-09 Thread jfong
I had tried the following script test.py: import tkinter as tk class Demo(tk.Frame): def __init__(self): tk.Frame.__init__(self, name='demo') self.pack() panel = tk.Frame(self, name='panel') panel.pack() start =

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-09 Thread jfong
Terry Reedy於 2019年9月9日星期一 UTC+8下午3時06分27秒寫道: > On 9/8/2019 8:40 PM, jf...@ms4.hinet.net wrote: > > > Thank you. After a quick trace to find out the reason, I found that Tkinter > > prevents Tk() be called more than once from widget constructors, so only > > one Tk object exists:-) > > There

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
David於 2019年9月8日星期日 UTC+8下午8時14分03秒寫道: > On Sun, 8 Sep 2019 at 21:05, wrote: > > David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道: > > > On Sun, 8 Sep 2019 at 20:25, wrote: > > > > > If I have two widgets created this way: > > > > t0 = tkinter.Text() > > > > t1 = tkinter.Text() > > > > How many Tk objects

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道: > On Sun, 8 Sep 2019 at 20:25, wrote: > > > > If I have two widgets created this way: > > t0 = tkinter.Text() > > t1 = tkinter.Text() > > How many Tk objects will there be? > > $ python3 > Python 3.5.3 (default, Sep 27 2018, 17:25:39) > [GCC 6.3.0 20170516]

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
Terry Reedy於 2019年9月8日星期日 UTC+8下午5時31分34秒寫道: > On 9/7/2019 9:44 PM, jf...@ms4.hinet.net wrote: > > I know it is valid, according to the Tkinter source, every widget > > constructor has a 'master=None' default. What happens on doing this? > > Tkinter creates a default Tk object and uses that as

Is it 'fine' to instantiate a widget without parent parameter?

2019-09-07 Thread jfong
I know it is valid, according to the Tkinter source, every widget constructor has a 'master=None' default. What happens on doing this? In what circumstance, we do it this way? and will it cause any trouble? --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: How to record the console's content in the interpreter?

2019-08-23 Thread jfong
eryk sun於 2019年8月24日星期六 UTC+8上午2時53分56秒寫道: > On 8/23/19, jf...@ms4.hinet.net wrote: > > > > it won't show output from print command, and "print" is the most > > command used in a module when a response was needed > > ConEmu is an alternate console for Windows that allows logging all > console

Re: How to record the console's content in the interpreter?

2019-08-23 Thread jfong
Terry Reedy於 2019年8月23日星期五 UTC+8下午7時27分50秒寫道: > On 8/23/2019 3:42 AM, jf...@ms4.hinet.net wrote: > > > Say I like to record everything showing in the console into a file > > after I start a debug session, and stop it when finished. It's not > > a console redirection. I still need to

Re: How to record the console's content in the interpreter?

2019-08-23 Thread jfong
Manfred Lotz於 2019年8月23日星期五 UTC+8下午6時08分11秒寫道: > On Fri, 23 Aug 2019 00:42:26 -0700 (PDT) > jf...@ms4.hinet.net wrote: > > > Manfred Lotz於 2019年8月23日星期五 UTC+8下午2時58分48秒寫道: > > > On Thu, 22 Aug 2019 21:48:33 -0700 (PDT) > > > jf...@ms4.hinet.net wrote: > > > > > > > Cameron Simpson於

Re: How to record the console's content in the interpreter?

2019-08-23 Thread jfong
Manfred Lotz於 2019年8月23日星期五 UTC+8下午2時58分48秒寫道: > On Thu, 22 Aug 2019 21:48:33 -0700 (PDT) > jf...@ms4.hinet.net wrote: > > > Cameron Simpson於 2019年8月23日星期五 UTC+8下午12時09分54秒寫道: > > > On 22Aug2019 19:38, Jach Fong wrote: > > > >Say I like to record everything showing in the console into a file >

Re: How to record the console's content in the interpreter?

2019-08-22 Thread jfong
Cameron Simpson於 2019年8月23日星期五 UTC+8下午12時09分54秒寫道: > On 22Aug2019 19:38, Jach Fong wrote: > >Say I like to record everything showing in the console into a file > >after I start a debug session, and stop it when finished. It's not > >a console redirection. I still need to see what is going on

How to record the console's content in the interpreter?

2019-08-22 Thread jfong
Say I like to record everything showing in the console into a file after I start a debug session, and stop it when finished. It's not a console redirection. I still need to see what is going on during the session. --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: Which editor is suited for view a python package's source?

2019-08-20 Thread jfong
Nick Sarbicki於 2019年8月20日星期二 UTC+8下午1時33分32秒寫道: > Yes the community edition works fine. > > It seems to require a 64 bit version of Windows 7 or higher (I'm not sure > as I haven't used Windows in years). > > On Tue, 20 Aug 2019, 03:27 , wrote: > > > Nick Sarbicki於 2019年8月19日星期一

Re: Which editor is suited for view a python package's source?

2019-08-19 Thread jfong
Nick Sarbicki於 2019年8月19日星期一 UTC+8下午5時33分27秒寫道: > PyCharm takes you to the source code within the editor for any > variables/functions/classes/modules if you ctrl+click on what you want to > see. It allows you to browse the relevant bits of code quickly, as well as > let you change them in your

Which editor is suited for view a python package's source?

2019-08-19 Thread jfong
I like to download one package's source and study it in an editor. It allows me to open the whole package as a project and let me jump from a reference in one file to its definition in another file back and forth. It will be even better if it can handle the import modules too. (Maybe this is

Re: Is there a simple way to wrap a built-in function for the whole package?

2019-08-02 Thread jfong
Batuhan Taskaya於 2019年8月3日星期六 UTC+8上午5時27分49秒寫道: > functools.partial is a better option > > On Fri, Aug 2, 2019, 1:25 AM Cameron Simpson wrote: > > > On 31Jul2019 19:16, Jach Fong wrote: > > >I get a package from Pypi. The package has many modules using built-in > > open() function. I like to

Re: Is there a simple way to wrap a built-in function for the whole package?

2019-08-01 Thread jfong
Cameron Simpson於 2019年8月2日星期五 UTC+8上午6時25分00秒寫道: > On 31Jul2019 19:16, Jach Fong wrote: > >I get a package from Pypi. The package has many modules using built-in > >open() function. I like to redefine all the open() there with the default > >encoding 'utf-8', but not for code outside the

Is there a simple way to wrap a built-in function for the whole package?

2019-07-31 Thread jfong
I get a package from Pypi. The package has many modules using built-in open() function. I like to redefine all the open() there with the default encoding 'utf-8', but not for code outside the package. Maybe I can put my def statement at the beginning of every module of this package, but just

Re: What's wrong on using Popen's communicate method?

2019-07-07 Thread jfong
eryk sun於 2019年7月7日星期日 UTC+8下午3時51分57秒寫道: > On 7/6/19, jf...@ms4.hinet.net wrote: > > > > I turn off the anti-virus and tried v3.6.8, get the same result. Usually the > > anti-virus program will warn me if something was blocked. > > In case the executable is corrupt, clear your browser cache and

Re: What's wrong on using Popen's communicate method?

2019-07-07 Thread jfong
eryk sun於 2019年7月7日星期日 UTC+8下午3時51分57秒寫道: > On 7/6/19, jf...@ms4.hinet.net wrote: > > > > I turn off the anti-virus and tried v3.6.8, get the same result. Usually the > > anti-virus program will warn me if something was blocked. > > In case the executable is corrupt, clear your browser cache and

Re: What's wrong on using Popen's communicate method?

2019-07-06 Thread jfong
eryk sun於 2019年7月7日星期日 UTC+8下午12時00分47秒寫道: > On 7/6/19, jf...@ms4.hinet.net wrote: > > > > In TEMP, there is only one file "chrome_installer.log" dated at the time of > > doing the upgrade (strange?, why chrome?). No errors in it. > > So the installer doesn't even execute. Do you maybe have an >

Re: What's wrong on using Popen's communicate method?

2019-07-06 Thread jfong
eryk sun於 2019年7月7日星期日 UTC+8上午10時13分34秒寫道: > On 7/6/19, jf...@ms4.hinet.net wrote: > > > > According to the info you give, I have done the following steps: > > 1. Upgrade to SP2 first. > > 2. Install the CRT update. > > But the result is still the same, nothing happens after double click the > >

Re: What's wrong on using Popen's communicate method?

2019-07-06 Thread jfong
eryk sun於 2019年7月6日星期六 UTC+8下午6時26分42秒寫道: > On 7/6/19, jf...@ms4.hinet.net wrote: > > eryk sun於 2019年7月6日星期六 UTC+8下午2時13分23秒寫道: > > > >> Major versions of Python support Windows versions that have extended > >> support from Microsoft at the time of the first release. For Vista, > >> extended

Re: What's wrong on using Popen's communicate method?

2019-07-06 Thread jfong
Michael Torrie於 2019年7月6日星期六 UTC+8下午12時02分02秒寫道: > On 07/05/2019 09:03 PM, jf...@ms4.hinet.net wrote: > > From Vista to Win10? That's a three generation gap! Buy a new PC might > > be a better solution:-) > > Maybe. Windows 10 would probably run okay on that machine. It might be > 10 years

Re: What's wrong on using Popen's communicate method?

2019-07-06 Thread jfong
eryk sun於 2019年7月6日星期六 UTC+8下午2時13分23秒寫道: > On 7/5/19, jf...@ms4.hinet.net wrote: > > Terry Reedy於 2019年7月5日星期五 UTC+8上午12時13分25秒寫道: > > > >> Upgrade to 3.7 or 3.8 to get hundreds of bug fixes, let alone new > >> features. Both subprocess and multiprocessing have gotten fixes. > > > > I can't

Re: What's wrong on using Popen's communicate method?

2019-07-05 Thread jfong
Chris Angelico於 2019年7月6日星期六 UTC+8上午10時48分10秒寫道: > On Sat, Jul 6, 2019 at 12:31 PM wrote: > > > > Terry Reedy於 2019年7月5日星期五 UTC+8上午12時13分25秒寫道: > > > On 7/3/2019 7:57 PM, jf...@ms4.hinet.net wrote: > > > > I have the test0.py below. I expect to see 'abcd' showing in the > > > > notepad window: >

Re: What's wrong on using Popen's communicate method?

2019-07-05 Thread jfong
Terry Reedy於 2019年7月5日星期五 UTC+8上午12時13分25秒寫道: > On 7/3/2019 7:57 PM, jf...@ms4.hinet.net wrote: > > I have the test0.py below. I expect to see 'abcd' showing in the notepad > > window: > > - > > import subprocess as sp > > p0 = sp.Popen('notepad.exe', stdin=sp.PIPE) > >

Re: What's wrong on using Popen's communicate method?

2019-07-03 Thread jfong
Wildman於 2019年7月4日星期四 UTC+8上午11時15分57秒寫道: > On Thu, 04 Jul 2019 10:36:36 +1000, Cameron Simpson wrote: > > > On 03Jul2019 16:57, Jach Fong wrote: > >>I have the test0.py below. I expect to see 'abcd' showing in the notepad > >>window: > >>- > >>import subprocess as sp > >>p0 =

Re: What's wrong on using Popen's communicate method?

2019-07-03 Thread jfong
Chris Angelico於 2019年7月4日星期四 UTC+8上午8時37分13秒寫道: > On Thu, Jul 4, 2019 at 10:01 AM wrote: > > > > I have the test0.py below. I expect to see 'abcd' showing in the notepad > > window: > > - > > import subprocess as sp > > p0 = sp.Popen('notepad.exe', stdin=sp.PIPE) > >

What's wrong on using Popen's communicate method?

2019-07-03 Thread jfong
I have the test0.py below. I expect to see 'abcd' showing in the notepad window: - import subprocess as sp p0 = sp.Popen('notepad.exe', stdin=sp.PIPE) p0.communicate(input=b'abcd') - But nothing happens. The notepad is completely empty. What have I missed? --Jach PS. I am using

Re: Which curses version should I use under Windows

2019-06-18 Thread jfong
MRAB於 2019年6月18日星期二 UTC+8下午6時12分50秒寫道: > On 2019-06-18 04:57, jf...@ms4.hinet.net wrote: > > Terry Reedy於 2019年6月18日星期二 UTC+8上午11時03分00秒寫道: > >> On 6/17/2019 10:54 PM, jf...@ms4.hinet.net wrote: > >> > >> > c:\Works\Python34>pip install windows-curses > >> > DEPRECATION: Python 3.4 support has

Re: Which curses version should I use under Windows

2019-06-17 Thread jfong
Terry Reedy於 2019年6月18日星期二 UTC+8上午11時03分00秒寫道: > On 6/17/2019 10:54 PM, jf...@ms4.hinet.net wrote: > > > c:\Works\Python34>pip install windows-curses > > DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the > > last one supporting it. Please upgrade your Python as Python 3.4

Re: Which curses version should I use under Windows

2019-06-17 Thread jfong
MRAB於 2019年6月18日星期二 UTC+8上午10時08分23秒寫道: > On 2019-06-18 02:39, jf...@ms4.hinet.net wrote: > > As many others had encountered, when I import the curses module under > > Windows, I got > > > > ImportError: No module named '_curses' > > > > Search "curses" on the Pypi returns plenty of

Which curses version should I use under Windows

2019-06-17 Thread jfong
As many others had encountered, when I import the curses module under Windows, I got ImportError: No module named '_curses' Search "curses" on the Pypi returns plenty of related packages. Which one should I use? Is this package still valid on usage? Any comment will be appreciated.

Re: tkinter.tix "Control" widget don't work with StringVar?

2019-06-01 Thread jfong
MRAB於 2019年6月2日星期日 UTC+8上午10時18分36秒寫道: > On 2019-06-02 02:28, jf...@ms4.hinet.net wrote: > > Below is a simplified version of the sample script downloaded from its > > package. > > When run it, the entry field display '0' instead of 'P'. > > PS. I am using Python 3.4.4, Windows 32bit > > > >

tkinter.tix "Control" widget don't work with StringVar?

2019-06-01 Thread jfong
Below is a simplified version of the sample script downloaded from its package. When run it, the entry field display '0' instead of 'P'. PS. I am using Python 3.4.4, Windows 32bit test0.py 1 from tkinter import tix as Tix 2 3 root = Tix.Tk() 4 5 demo_maker = Tix.StringVar() 6

Re: Instance vs Class variable oddity

2019-05-18 Thread jfong
Chris Angelico於 2019年5月18日星期六 UTC+8下午3時09分37秒寫道: > On Sat, May 18, 2019 at 1:51 PM wrote: > > > > Correct me if I am wrong, please. > > > > I always think that the LEGB rule (e.g. the namespace to look up for) was > > applied at compile-time, only the binding was resolved "dynamically" at > >

Re: Instance vs Class variable oddity

2019-05-17 Thread jfong
Correct me if I am wrong, please. I always think that the LEGB rule (e.g. the namespace to look up for) was applied at compile-time, only the binding was resolved "dynamically" at run-time. For example: def foo(): print(x) foo() will cause a NameError. But after x = 5 foo() will run

How to debug a function under the (pdb) prompt?

2019-05-10 Thread jfong
For example, there is a file test0.py: - 1 def foo(): 2 for i in range(3): 3 print(i) 4 5 x = 0 - I start the debug session as below. My question is why the break point at line 3 didn't work. How to debug the function foo() at this time? D:\Works\Python>py -m pdb

Re: Implement C's Switch in Python 3

2019-03-15 Thread jfong
Sayth Renshaw at 2019/2/3 UTC+8 AM9:52:50 wrote: > Or perhaps use a 3rd party library like > https://github.com/mikeckennedy/python-switch Thank you for this link. It's a good general implementation. --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: Quirk difference between classes and functions

2019-02-27 Thread jfong
jf...@ms4.hinet.net於 2019年2月26日星期二 UTC+8下午4時46分04秒寫道: > ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道: > > Hello > > > > I noticed a quirk difference between classes and functions > > > > >>> x=0 > > >>> > > >>> class Test: > > x = x+1 > > print(x) > > x = x+1 > >

Re: Quirk difference between classes and functions

2019-02-26 Thread jfong
Chris Angelico於 2019年2月27日星期三 UTC+8上午11時29分04秒寫道: > On Wed, Feb 27, 2019 at 2:21 PM wrote: > > > > Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道: > > > On Wed, Feb 27, 2019 at 12:21 PM wrote: > > > > > > > > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote: > > > > > Thomas Jollans wrote: > > > > >

Re: Quirk difference between classes and functions

2019-02-26 Thread jfong
Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道: > On Wed, Feb 27, 2019 at 12:21 PM wrote: > > > > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote: > > > Thomas Jollans wrote: > > > > I imagine there's a justification for the difference in behaviour to do > > > > with the fact that the body of a

Re: Quirk difference between classes and functions

2019-02-26 Thread jfong
Gregory Ewing at 2019/2/27 AM 5:26:49 wrote: > Thomas Jollans wrote: > > I imagine there's a justification for the difference in behaviour to do > > with the fact that the body of a class is only ever executed once, while > > the body of a function is executed multiple times. > > I suspect there

Re: Quirk difference between classes and functions

2019-02-26 Thread jfong
ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道: > Hello > > I noticed a quirk difference between classes and functions > > >>> x=0 > >>> > >>> class Test: > x = x+1 > print(x) > x = x+1 > print(x) > > 1 > 2 > >>> print(x) > 0 > > Previous code doesn't generate

Ask for help on using asynctk package

2019-02-20 Thread jfong
The file below is a simple script to test this package. - # test_asynctk.py import asynctk as atk root = atk.AsyncTk() def delay5S(): btn0.after(5000) def inc1(): msgs = btn1.cget('text').split() n = int(msgs[1]) msg = msgs[0] + ' ' + str(n+1)

Re: Problem : Generator

2019-02-15 Thread jfong
Prahallad Achar於 2019年2月15日星期五 UTC+8下午5時27分36秒寫道: > I get list object instead gen obj > > On Fri, 15 Feb 2019, 13:57 Chris Angelico > > On Fri, Feb 15, 2019 at 6:57 PM Prahallad Achar > > wrote: > > > > > > How about this > > > List1=[ 1,2,3,4] > > > Rever_gen = ( x*x for x in list1, reversed

Re: How to run a module before install?

2019-01-14 Thread jfong
Peter Otten於 2019年1月14日星期一 UTC+8下午4時04分33秒寫道: > jf...@ms4.hinet.net wrote: > > > I had download a module which has the following directory structure: > > > > [XL-Sudoku-Solver_master] > > |__[tests] > > |__[xl_sudoku_solver] > > |__setup.py |__ __init__.py > > |__problem1.txt |__

How to run a module before install?

2019-01-13 Thread jfong
I had download a module which has the following directory structure: [XL-Sudoku-Solver_master] |__[tests] |__[xl_sudoku_solver] |__setup.py |__ __init__.py |__problem1.txt |__ __main__.py |__README.md |__ ... |__ ... The setup.py file has something like this:

Re: Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-28 Thread jfong
jf...@ms4.hinet.net於 2018年12月28日星期五 UTC+8下午4時04分07秒寫道: > eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote: > > On 12/27/18, jf...@ms4.hinet.net wrote: > > > > > > I still don't get it. When I change it to using list comprehension, the > > > problem is still there. (it now has no late-binding

Re: Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-28 Thread jfong
eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote: > On 12/27/18, jf...@ms4.hinet.net wrote: > > > > I still don't get it. When I change it to using list comprehension, the > > problem is still there. (it now has no late-binding variable, right? :-) > > > class Too: > > ... XS = [15, 15, 15,

Re: Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-27 Thread jfong
eryk sun於 2018年12月27日星期四 UTC+8下午2時31分58秒寫道: > On 12/26/18, jf...@ms4.hinet.net wrote: > > I saw the code below at stackoverflow. I have a little idea about the scope > > of a class, and list comprehension and generator expressions, but still > > can't figure out why Z4 works and Z5 not. Can

Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-26 Thread jfong
I saw the code below at stackoverflow. I have a little idea about the scope of a class, and list comprehension and generator expressions, but still can't figure out why Z4 works and Z5 not. Can someone explain it? (in a not-too-complicated way:-) class Foo(): XS = [15, 15, 15, 15] Z4 =

Re: Smarter algo, was Re: 03 digression by brute force

2018-12-16 Thread jfong
BlindAnagram at 2018/12/15 UTC+8 PM 8:41:21 wrote: > On 15/12/2018 09:56, jf...@ms4.hinet.net wrote: > > Appreciate your thoughtfully analysis on this code. Before generalize it > > with arbitrary additions, as Peter suggested:-), a recursive version is > > needed. I may give it a try on this

Re: Smarter algo, was Re: 03 digression by brute force

2018-12-15 Thread jfong
Appreciate your thoughtfully analysis on this code. Before generalize it with arbitrary additions, as Peter suggested:-), a recursive version is needed. I may give it a try on this Sunday. Avi Gross at 2018/12/15 UTC+8 AM8:13:37 wrote: > REAL SUBJECT: Analysis of alternate algorithms. > >

Re: 03 digression by brute force

2018-12-13 Thread jfong
Just for fun:-) On my ooold PC, it takes 0.047 seconds to run the following algorithm on the problem 'SNED + MORE == MONEY". - import time import itertools #S, E, N, D, M, O, R, Y n = 0 digits = {x for x in range(10)} def tenThousand(u, Cin): # Cin == M global

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread jfong
Chris Angelico於 2018年12月10日星期一 UTC+8下午7時09分01秒寫道: > On Mon, Dec 10, 2018 at 9:46 PM wrote: > > > > Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道: > > > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon > > > wrote: > > > > > > > > On 10/12/18 11:03, Chris Angelico wrote: > > > > > Considering

Re: Why Python don't accept 03 as a number?

2018-12-10 Thread jfong
Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道: > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon wrote: > > > > On 10/12/18 11:03, Chris Angelico wrote: > > > Considering that, in a problem of that description, neither S nor M > > > may represent zero, I don't think there's a problem here. > > >

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread jfong
Avi Gross於 2018年12月9日星期日 UTC+8上午1時40分26秒寫道: > Jach, > > Just for fun, I looked at the puzzle you asked about and solved it several > ways without running into your 03 problem at all. There are more efficient > solutions than total brute force. > > Anyone not interested, stop here, please. After

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread jfong
Grant Edwards於 2018年12月9日星期日 UTC+8上午12時52分04秒寫道: > On 2018-12-08, Cameron Simpson wrote: > > On 07Dec2018 20:24, Jach Fong wrote: > >>Ian at 2018/12/8 UTC+8 AM11:28:34 wrote: > >>> What is it exactly that you're trying to accomplish with this? Perhaps > >>> there's a better way than using eval.

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread jfong
Avi Gross at 2018/12/8 UTC+8 PM2:09:20 wrote: > [[READERS DIGEST CONDENSED ANSWER: use int("string") ]] > > Since we all agree python will not make notations like "05" work > indefinitely, and the need expressed is how to solve a symbolic puzzle (see > message below) then it makes sense to look

Re: Why Python don't accept 03 as a number?

2018-12-07 Thread jfong
I can understand the difficulty of throwing old thing away and accept new one in human. There seems have a huge inertia there. This phenomenon appears on every aspects, not only on the transition from Python2 to Python3. But, as a new comer of Python like me, I have no difficulty to accept it

Re: Why Python don't accept 03 as a number?

2018-12-07 Thread jfong
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote: > What is it exactly that you're trying to accomplish with this? Perhaps > there's a better way than using eval. This problem comes from solving a word puzzle, ab + aa + cd == ce Each character will be translate to a digit and evaluate the correctness,

Re: Why Python don't accept 03 as a number?

2018-12-07 Thread jfong
MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote: > Before Python 3, a leading 0 in an integer literal would indicate an > octal (base 8) number. So, the reason is historical. > The old form is now invalid in order to reduce the chance of bugs. I encounter this problem on trying to do something like

Why Python don't accept 03 as a number?

2018-12-07 Thread jfong
>>> 00 0 >>> 03 File "", line 1 03 ^ SyntaxError: invalid token >>> Any particular reason? -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it dangeous when using custom metaclass?

2018-10-17 Thread jfong
dieter at 2018/10/17 UTC+8 PM 1:15:01 wrote: > jf...@ms4.hinet.net writes: > > Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote > >> jf...@ms4.hinet.net wrote: > >> > class Structure(metaclass=StructureMeta): ... > >> > > >> > class PolyHeader(Structure): ... > >> > > >> > As my understanding,

Re: Is it dangeous when using custom metaclass?

2018-10-16 Thread jfong
Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote > jf...@ms4.hinet.net wrote: > > class Structure(metaclass=StructureMeta): ... > > > > class PolyHeader(Structure): ... > > > > As my understanding, the metaclass's __init__ was called when a class was > > created. In the above example, both the

Is it dangeous when using custom metaclass?

2018-10-15 Thread jfong
class StructureMeta(type): def __init__(self, clsname, bases, clsdict): offset = 0 ... ... setattr(self, 'struct_size', offset) class Structure(metaclass=StructureMeta): ... ... class PolyHeader(Structure): ... ... As my understanding, the

Re: How to run/debug a script file its name has characters such as space, (, etc.

2018-10-12 Thread jfong
Chris Angelico於 2018年10月12日星期五 UTC+8下午4時39分37秒寫道: > On Fri, Oct 12, 2018 at 6:26 PM wrote: > > > > I saw a directory where all its filenames are something like this: > > ... > > 1a PSG (Entry and PopUp).py > > 1b PSG (Format).py > > 1c PSG (persistent form and bind key).py > > ... > > > > Just

How to run/debug a script file its name has characters such as space, (, etc.

2018-10-12 Thread jfong
I saw a directory where all its filenames are something like this: ... 1a PSG (Entry and PopUp).py 1b PSG (Format).py 1c PSG (persistent form and bind key).py ... Just wondering how these file can run and debugged under Windows? --Jach -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   >