Re: Python3.6 tkinter bug

2017-01-31 Thread George Trojan - NOAA Federal
On 2017-01-31 18:02, MRAB wrote: On 2017-01-31 22:34, Christian Gollwitzer wrote: > >* Am 31.01.17 um 20:18 schrieb George Trojan - NOAA Federal: > *>>* Selection of button 'A' also selects button 'C'. Same goes for 'B' and > 'D'. >

Python3.6 tkinter bug?

2017-01-31 Thread George Trojan - NOAA Federal
The following program behaves differently under Python 3.6: ''' checkbutton test ''' import tkinter class GUI(tkinter.Tk): def __init__(self): tkinter.Tk.__init__(self) frame = tkinter.Frame(self) for tag in ('A', 'B'): w = tkinter.Checkbutton(frame, text=

Re: Splitting text into lines

2016-12-13 Thread George Trojan - NOAA Federal
> > Tell Python to keep the newline chars as seen with > open(filename, newline="") > For example: > >>> > * open("odd-newlines.txt", "rb").read() * > b'alpha\nbeta\r\r\ngamma\r\r\ndelta\n' > >>> > * open("odd-newlines.txt", "r", newline="").read().replace("\r", * > "").splitlines() > ['alpha', 'be

Re: Splitting text into lines

2016-12-13 Thread George Trojan - NOAA Federal
> > Are repeated newlines/carriage returns significant at all? What about > just using re and just replacing any repeated instances of '\r' or '\n' > with '\n'? I.e. something like > >>> # the_string is your file all read in > >>> import re > >>> re.sub("[\r\n]+", "\n", the_string) > and then co

Splitting text into lines

2016-12-13 Thread George Trojan - NOAA Federal
I have files containing ASCII text with line s separated by '\r\r\n'. Example: $ od -c FTAK31_PANC_131140.1481629265635 000 F T A K 3 1 P A N C 1 3 1 1 020 4 0 \r \r \n T A F A B E \r \r \n T A 040 F \r \r \n P A

Re: functools puzzle

2016-04-06 Thread George Trojan - NOAA Federal
16, at 6:57 PM, George Trojan - NOAA Federal < > george.tro...@noaa.gov> wrote: > > > > The module functools has partial() defined as above, then overrides the > > definition by importing partial from _functools. That would explain the > > above behaviour. My question

functools puzzle

2016-04-06 Thread George Trojan - NOAA Federal
Here is my test program: ''' generic test ''' import functools import inspect def f(): '''I am f''' pass g = functools.partial(f) g.__doc__ = '''I am g''' g.__name__ = 'g' def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy()

A tool to add diagrams to sphinx docs

2016-04-01 Thread George Trojan - NOAA Federal
What graphics editor would you recommend to create diagrams that can be included in sphinx made documentation? In the past I used xfig, but was not happy with font quality. My understanding is the diagrams would be saved in a .png file and I should use an image directive in the relevant .rst file.