Re: Weird list conversion

2015-12-13 Thread KP
On Sunday, 13 December 2015 11:57:57 UTC-8, Laura Creighton wrote: > In a message of Sun, 13 Dec 2015 11:45:19 -0800, KP writes: > >Hi all, > > > > f = open("stairs.bin", "rb") > > data = list(f.read(16)) > > print data >

List of integers

2015-12-13 Thread KP
data = list(f.read(4)) print data from a binary file might give ['\x10', '\x20', '\x12', '\x01'] How can I receive this instead? [0x10, 0x20, 0x12, 0x01] Thanks for all help! -- https://mail.python.org/mailman/listinfo/python-list

Re: List of integers

2015-12-13 Thread KP
On Sunday, 13 December 2015 16:33:20 UTC-8, Chris Angelico wrote: > On Mon, Dec 14, 2015 at 11:24 AM, KP <> wrote: > > data = list(f.read(4)) > > print data > > > > from a binary file might give > > > > ['\x10', '\x20', '\x

Newbie XML problem

2015-12-21 Thread KP
>From my first foray into XML with Python: I would like to retrieve this list from the XML upon searching for the 'config' with id attribute = 'B' config = {id: 1, canvas: (3840, 1024), comment: "a comment", {id: 4, gate: 3, (0,0, 1280, 1024)}, {id: 5, gate: 2,

Re: Newbie XML problem

2015-12-22 Thread KP
Thank you both - your help is much appreciated! -- https://mail.python.org/mailman/listinfo/python-list

Newbie: String to Tuple

2015-12-22 Thread KP
How do I convert '1280,1024' to (1280,1024) ? Thanks for all help! -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie: String to Tuple

2015-12-22 Thread KP
On Tuesday, 22 December 2015 12:59:59 UTC-8, Mark Lawrence wrote: > On 22/12/2015 20:53, KP wrote: > > How do I convert > > > > '1280,1024' > > > > to > > > > (1280,1024) ? > > > > Thanks for all help! > > >

Newbie: Convert strings in nested dict to tuples

2015-12-22 Thread KP
I now know how to convert a string cont. coordinates to a tuple, but hwo can I do this? Given cfg = {'canvas': ('3840', '1024'), 'panel1': {'gpio': '1', 'id': '4', 'co': '0,0,1280,1024'}, 'panel2': {'gpio': '2', 'id': '5', 'co': '1280,0,2560,1024'}, 'panel3': {'gpio': '3', 'id

Re: Newbie: Convert strings in nested dict to tuples

2015-12-22 Thread KP
Beautiful - thanks! On Tuesday, 22 December 2015 15:23:25 UTC-8, Peter Otten wrote: > KP wrote: > > > I now know how to convert a string cont. coordinates to a tuple, but hwo > > can I do this? > > > > Given > > > > cfg = {'canvas': ('3

Idiom for this case?

2015-12-24 Thread KP
Given: cfg = {'c': ('3840', '1024'), 'p1': {'gpio': '1', 'id': '4', 'coord': ('0', '0', '1280', '1024')}, 'p2': {'gpio': '2', 'id': '5', 'coord': ('1280', '0', '2560', '1024')}, 'p3': {'gpio': '3', 'id': '6', 'coord': ('2560', '0', '3840', '1024')}} for config in cfg: i

Is there an idiom for this?

2015-12-24 Thread KP
Given: cfg = {'c': ('3840', '1024'), 'p1': {'gpio': '1', 'id': '4', 'coord': ('0', '0', '1280', '1024')}, 'p2': {'gpio': '2', 'id': '5', 'coord': ('1280', '0', '2560', '1024')}, 'p3': {'gpio': '3', 'id': '6', 'coord': ('2560', '0', '3840', '1024')}} for config in cfg:

Re: Is there an idiom for this?

2015-12-24 Thread KP
Thanks Paul, you just pointed out one of my blonder moments: I actually want all nested dicts one by one, but not the one with the 'c' key... On Thursday, 24 December 2015 14:15:45 UTC-8, Paul Rubin wrote: > KP writes: > > for config in cfg: > > if config !

Re: Fast pythonic way to process a huge integer list

2016-01-07 Thread KP
On Wednesday, 6 January 2016 18:37:22 UTC-8, high5s...@gmail.com wrote: > I have a list of 163.840 integers. What is a fast & pythonic way to process > this list in 1,280 chunks of 128 integers? Thanks all for your valuable input - much appreciated! -- https://mail.python.org/mailman/listinfo/p

tkinter newbie question

2016-01-24 Thread KP
See my code below (which works). I'd like to have the 2nd window as a class in a separate unit. How do I code that unit and how do I call it from my first unit? As always, thanks for all help! #!/usr/bin/env python """ """ from tkinter import * from settings import * class window1():

Re: tkinter newbie question

2016-01-25 Thread KP
On Sunday, 24 January 2016 20:20:07 UTC-8, KP wrote: > See my code below (which works). I'd like to have the 2nd window as a class > in a separate unit. How do I code that unit and how do I call it from my > first unit? > > As always, thanks for all help! > > >

Re: tkinter newbie question

2016-01-25 Thread KP
On Monday, 25 January 2016 08:22:12 UTC-8, KP wrote: > On Monday, 25 January 2016 00:51:34 UTC-8, Peter Otten wrote: > > KP wrote: > > > > > See my code below (which works). > > > > >From the import of lowercase "tkinter" I conclude you are us

Re: tkinter newbie question

2016-01-25 Thread KP
On Monday, 25 January 2016 00:51:34 UTC-8, Peter Otten wrote: > KP wrote: > > > See my code below (which works). > > >From the import of lowercase "tkinter" I conclude you are using Python 3. > > > I'd like to have the 2nd window as a > > cl

Tkinter spacing

2016-01-25 Thread KP
If I want to have some space between, say, btn_last & btn_new, will I have to use a dummy label in between these two or is there a better way? Thanks for any help, as always! from tkinter import * from tkinter import ttk root = Tk() root.geometry("822x600+100+100") nav_bar = ttk.Frame(root,

Font issues Tkinter/Python 3.5

2016-01-29 Thread KP
import tkinter as tk from tkinter import ttk from tkinter import font ... def __init__(self): self.root = tk.Tk() self.root.title('Main Window') self.root.geometry('1000x800+200+200') self.root.minsize(width=1000, height=800) default_font = tkFon

How to install PIL or PILLOW on OS X Yosemite?

2015-02-15 Thread KP
Hi, just upgraded my Mac Mini to Yosemite and have never dabbled in Python on this OS. I see it has Python 2.7.6 installed. When I do something like from PIL import ImageFont, ImageDraw it tells me that it cannot find PIL How do I install this on Yosemite? Any pointers much appreciated KP