Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread Steven D'Aprano
On Thu, Feb 23, 2017 at 09:40:14PM +1100, Steven D'Aprano wrote: > How do instance attributes normally get set? In the __init__ method: > > class MyClass: > def __init__(self): > self.attribute = None > > > If the __init__ method does get run, it doesn't get the chance to create >

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread boB Stepp
On Wed, Feb 22, 2017 at 10:49 PM, Zachary Ware wrote: > On Wed, Feb 22, 2017 at 10:25 PM, boB Stepp wrote: > > I'll give you a couple of hints. First, try this: > > print('defining A') > class A: > print('Setting a on class A') When I typed this in I was surprised to find that the print()

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread boB Stepp
Thank you to everyone that provided illumination in this thread! Things seem much clearer now, which caused me to realize that what I wrote below cannot work as written (Even though I did copy and paste it from the interpreter): On Wed, Feb 22, 2017 at 10:53 PM, boB Stepp wrote: > On Wed, Feb 22,

Re: [Tutor] Multiple muti-selection dropdown options

2017-02-23 Thread Alan Gauld via Tutor
On 23/02/17 22:25, Pooja Bhalode wrote: > I am working on GUI where I have two dropdown menus in a Toplevel of the > main root. That's not what your code shows. It shows scrolling listboxes, not menus. But it seems like a Frame with a set of checkboxes would be closer to what you actually want?

Re: [Tutor] Asking about Opening Teminal on Python

2017-02-23 Thread Alan Gauld via Tutor
On 23/02/17 22:16, Quang nguyen wrote: > Hi everyone, > I need to open a terminal on Raspberry Pi 2 in order to execute codesend of > 433Utils to send a signal to RF Receiver. Anyone know how to open a > terminal? Do you really need a terminal? Or do you only need to execute some commands? In eit

[Tutor] Multiple muti-selection dropdown options

2017-02-23 Thread Pooja Bhalode
Hi, I am working on GUI where I have two dropdown menus in a Toplevel of the main root. Here, both the dropdown menus have mutiple selection option and thus, the selections can be taken as an input from the user and printed out in the code. The window shows as below: [image: Inline image 1] Where

[Tutor] Asking about Opening Teminal on Python

2017-02-23 Thread Quang nguyen
Hi everyone, I need to open a terminal on Raspberry Pi 2 in order to execute codesend of 433Utils to send a signal to RF Receiver. Anyone know how to open a terminal? Thank you. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread Steven D'Aprano
On Wed, Feb 22, 2017 at 10:25:58PM -0600, boB Stepp wrote: > I am trying to wrap my head around the mechanics of inheritance in > Python 3. Here is a simplified picture of how inheritence usually works in Python. For an instance `spam`, when you look up an attribute (which includes methods), Pyt

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread Alan Gauld via Tutor
On 23/02/17 04:25, boB Stepp wrote: > I am trying to wrap my head around the mechanics of inheritance in > Python 3. I thought that all attributes of a superclass were > accessible to an instance of a subclass. For class attributes that happens automatically. >>> class A: a = 'A'

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread Steven D'Aprano
On Wed, Feb 22, 2017 at 10:25:58PM -0600, boB Stepp wrote: > I am trying to wrap my head around the mechanics of inheritance in > Python 3. I thought that all attributes of a superclass were > accessible to an instance of a subclass. But when I try the > following: > > py3: class A: > ... de

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread Peter Otten
boB Stepp wrote: > On Wed, Feb 22, 2017 at 10:25 PM, boB Stepp > wrote: >> I am trying to wrap my head around the mechanics of inheritance in >> Python 3. I thought that all attributes of a superclass were >> accessible to an instance of a subclass. But when I try the >> following: >> >> py3: c