Re: change spacing to two instead of four with pep8 or flake8?

2019-06-28 Thread Cameron Simpson
On 07Apr2014 20:06, Dennis wrote: In Pylint you can change the spacing multiplier from 4 spaces to two in its pylintrc, but for the life of me I cannot find a way to do this with the flake8 / pep8 utilities. I want to avoid ignoring E111 altogether if at all possible, because it may catch other

Re: Use global, or not

2019-06-28 Thread DL Neil
On 29/06/19 1:44 AM, Cecil Westerhof wrote: I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: global global_dict ... Is that an acceptable way to do this? If it works, isn't that the largest part of

Re: Handle foreign character web input

2019-06-28 Thread Terry Reedy
On 6/28/2019 4:25 PM, Tobiah wrote: A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1?  Does it depend on whether the name was cut and pasted from a Word doc. etc? Should I handle these internally as unicode?  Rig

Re: Handle foreign character web input

2019-06-28 Thread Akkana Peck
On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: > Also, what do people do when searching for a record. > Is there some way to get 'Ronngren' to match the other > possible foreign spellings? SequenceMatcher in difflib can do fuzzy string comparisons and should work for cases like that. There are oth

Re: Handle foreign character web input

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 7:01 AM Tobiah wrote: > > > On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM > Tobiah wrote: > >> > >> A guy comes in and enters his last name as RÖnngren. > >> > >> So what did the browser really give me; is it encoded > >> in some way, like lat

Re: Handle foreign character web input

2019-06-28 Thread inhahe
: > > On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM > Tobiah wrote: > > >> Also, what do people do when searching for a record. > >> Is there some way to get 'Ronngren' to match the other > >> possible foreign spellings? > > > > I think I've heard of algorithms that

Re: Handle foreign character web input

2019-06-28 Thread Tobiah
On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1? Does it depend on whether the name was cut and pasted from a Word do

Re: Handle foreign character web input

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: > > A guy comes in and enters his last name as RÖnngren. > > So what did the browser really give me; is it encoded > in some way, like latin-1? Does it depend on whether > the name was cut and pasted from a Word doc. etc? > Should I handle these inter

Handle foreign character web input

2019-06-28 Thread Tobiah
A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1? Does it depend on whether the name was cut and pasted from a Word doc. etc? Should I handle these internally as unicode? Right now my database tables are latin-1

Use global, or not

2019-06-28 Thread Cecil Westerhof
I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: global global_dict canceled_report = 'Genereren rapportage gecanceled.' created_report = 'Rapportage voor {} bestanden is gemaakt.' e

Re: Use global, or not

2019-06-28 Thread Rob Gaddi
On 6/28/19 6:44 AM, Cecil Westerhof wrote: I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: [snip] global_dict = { 'messages': messages, 'progress': progress, 'windo

Re: change spacing to two instead of four with pep8 or flake8?

2019-06-28 Thread shivam . patel
On Tuesday, April 8, 2014 at 8:55:46 AM UTC-4, Peter Otten wrote: > Dennis wrote: > > > In Pylint you can change the spacing multiplier from 4 spaces to two > > in its pylintrc, but for the life of me I cannot find a way to do this > > with the flake8 / pep8 utilities. > > > > I want to avoid ign

Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 1:51 AM Jon Ribbens via Python-list wrote: > > On 2019-06-28, Larry Martell wrote: > > On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez > > wrote: > >> > >> How do you insert an item into a dictionary? For example, I make a > >> dictionary called "dictionary". > >> > >> d

Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread Jon Ribbens via Python-list
On 2019-06-28, Larry Martell wrote: > On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez > wrote: >> >> How do you insert an item into a dictionary? For example, I make a >> dictionary called "dictionary". >> >> dictionary = {1: 'value1', 2: 'value3'} >> >> What if I wanted to add a value2 in the m

Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread Larry Martell
On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez wrote: > > How do you insert an item into a dictionary? For example, I make a dictionary > called "dictionary". > > dictionary = {1: 'value1', 2: 'value3'} > > What if I wanted to add a value2 in the middle of value1 and value3? Dicts are not orde

Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread Calvin Spealman
You simply assign to the key, like so: dictionary[3] = 'value2' But it isn't clear what you mean by "in the middle". On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez wrote: > How do you insert an item into a dictionary? For example, I make a > dictionary called "dictionary". > > dictionary = {

Re: Make sure the window title is visible in tkinter

2019-06-28 Thread CrazyVideoGamez
On Wednesday, June 26, 2019, at 7:44:15 AM UTC-4, Cecil Westerhof wrote: > I need to write a desktop program. I choose to use tkinter. How can I > make sure the window title is visible? For example when I have the > following code: > from tkinter import Button, filedialog, Label, messagebo

How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread CrazyVideoGamez
How do you insert an item into a dictionary? For example, I make a dictionary called "dictionary". dictionary = {1: 'value1', 2: 'value3'} What if I wanted to add a value2 in the middle of value1 and value3? -- https://mail.python.org/mailman/listinfo/python-list

Re: Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
Cameron Simpson writes: > On 28Jun2019 12:17, Cecil Westerhof wrote: >>Chris Angelico writes: >>> On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: I have a tkinter program where I have a function generate_report which in a try block calls the function append_row. This func

Re: Only a message at the highest exception

2019-06-28 Thread Cameron Simpson
On 28Jun2019 12:17, Cecil Westerhof wrote: Chris Angelico writes: On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: I have a tkinter program where I have a function generate_report which in a try block calls the function append_row. This function has also a try block. When they get an

Re: Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
Chris Angelico writes: > On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: >> >> I have a tkinter program where I have a function generate_report which >> in a try block calls the function append_row. This function has also a >> try block. When they get an exception they give message. But w

Re: Hiding a progressbar in tkinter

2019-06-28 Thread Cecil Westerhof
MRAB writes: > On 2019-06-26 16:47, Cecil Westerhof wrote: >> I just started with GUI stuff in tkinter. I have a progressbar, but I >> want it to be only visible when it is used. So I tried the following: >> window = Tk() >> window.title(window_str) >> frame = Frame(window) >>

Re: Only a message at the highest exception

2019-06-28 Thread Chris Angelico
On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: > > I have a tkinter program where I have a function generate_report which > in a try block calls the function append_row. This function has also a > try block. When they get an exception they give message. But when > append_row has already gi

Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
I have a tkinter program where I have a function generate_report which in a try block calls the function append_row. This function has also a try block. When they get an exception they give message. But when append_row has already given a message then generate_report should not. To implement this I

Re: Creating a Windows executable on a Linux system

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > Cecil Westerhof writes: > >> I need to write a Python desktop program. I create it on a Linux >> system, but it has to run on a Windows system. When looking at how to >> create an executable it seems that you need to be on a Windows system >> to create a Windows executa

Re: Copying a row from a range of Excel files to another

2019-06-28 Thread Cecil Westerhof
MRAB writes: > On 2019-06-26 22:14, Cecil Westerhof wrote: >> MRAB writes: >> >>> Does Workbook support the 'with' statement? >>> >>> If it does, then that's the best way of doing it. >>> >>> (Untested) >>> >>> with Workbook() as wb_out: >>> for filepath in filepathArr: >>>

Re: Creating a Windows executable on a Linux system

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > I need to write a Python desktop program. I create it on a Linux > system, but it has to run on a Windows system. When looking at how to > create an executable it seems that you need to be on a Windows system > to create a Windows executable. Is this true, or is it possi

Re: Make sure the window title is visible in tkinter

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > Wildman writes: > >> On Wed, 26 Jun 2019 13:25:15 +0200, Cecil Westerhof wrote: >> >>> I need to write a desktop program. I choose to use tkinter. How can I >>> make sure the window title is visible? For example when I have the >>> following code: >>> from tkinter

Re: Plumbing behind super()

2019-06-28 Thread Thomas Jollans
On 28/06/2019 02:13, adam.pre...@gmail.com wrote: I'm trying to mimick Python 3.6 as a .NET science project and have started to get into subclassing. The super() not-a-keyword-honestly-guys has tripped me up. I have to admit that I've professionally been doing a ton Python 2.7, so I'm not good