Re: Importing wxWidgets Help

RF <[email protected]> Thu, 22 Apr 2021 16:18:09 -0700 (PDT)
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
Thank you Tim for those comments. I've edited my code accordingly. Thank 
you.

Sorry about that -900. I forgot to remove the minus sign before I attached 
the zip file. I'm using a second monitor and that -900 positions the window 
fairly well on my second monitor. Just 900 positions it on my primary 
monitor which is the screen to my laptop. My second monitor is a large LCD 
screen, much easier for me to see.

On Thursday, April 22, 2021 at 11:14:22 AM UTC-7 Tim Roberts wrote:

> You confused my by setting the window position to X=-900, which places it 
> offscreen and hence invisible.  Usually, you don't want to specify a 
> position for your top-level window.  By removing that, your window shows up 
> for me.
>
> On Thursday, April 22, 2021 at 11:09:05 AM UTC-7 Tim Roberts wrote:
>
>> One more thing I forgot.  In your "MyTreeCtrl.__init__", you are trying 
>> to create another MyTreeCtrl.  Don't do that.  Within that class, you 
>> already ARE the MyTreeCtrl.  You don't need "self.tree.Bind", you just need 
>> "self.Bind"
>> On Thursday, April 22, 2021 at 11:05:31 AM UTC-7 Tim Roberts wrote:
>>
>>> You have two immediate problems.  First, in CoreFrame where you 
>>> instantiate MyTreeCtrl, you are passing `vbox` as the parent.  This is one 
>>> of the more confusing aspects of wxWidgets.  The windows and the sizers 
>>> live in two separate hierarchies.  A sizer controls a set of windows, but 
>>> it is not itself a window, and thus cannot be a parent.  You need to pass 
>>> "self" as the parent, so the frame becomes the parent window.  Essentially, 
>>> you create a whole bunch of windows in a hierarchy, and then you add those 
>>> windows to sizers (which have their own hierarchy) to control their 
>>> placement.
>>>
>>> The second problem is in "MyTreeCtrl.__init__" when you call 
>>> "wx.TreeCtrl.__init__".  If you look at the documentation, you'll see that 
>>> the parameters for that start out self, parent, id, pos, size, style, ...  
>>>  You are not passing a "pos", which is why you get an error.  Now, that's a 
>>> perfectly OK thing to do, but once you omit a positional parameter, the 
>>> rest have to be specified by name:  "wx.TreeCtrl.__init__(self, parent, id, 
>>> size=size, style=style)".  That should get you a little farther.
>>>
>>> On Wednesday, April 21, 2021 at 8:12:59 PM UTC-7 [email protected] 
>>> wrote:
>>>
>>>> I uploaded an older copy of my pxCore.py file. Attached is my latest 
>>>> version that I should have uploaded previously.
>>>>
>>>> On Wednesday, April 21, 2021 at 8:11:09 PM UTC-7 RF wrote:
>>>>
>>>>> So I decided to start out by incorporating my class MyTreeCtrl(wx.TreeCtrl): 
>>>>> at the top of my core project file pxCore.py. I have attached it as a zip 
>>>>> file.
>>>>>
>>>>> I just can't figure out how to make the call to create the TreeCtrl 
>>>>> without getting some kind of error.
>>>>>
>>>>> Currently the error in line 6 is: TypeError: TreeCtrl(): arguments did 
>>>>> not match any overloaded call:
>>>>>
>>>>> Thank you for any help.
>>>>>
>>>>> On Wednesday, April 21, 2021 at 3:35:38 PM UTC-7 RF wrote:
>>>>>
>>>>>>
>>>>>> I've written a class TreeCtrl python file. I'm trying to import it 
>>>>>> into my project's main python file.
>>>>>>
>>>>>> I can't find any examples of how this should be done. The examples 
>>>>>> I've found are very simple ones like Car.py located here: 
>>>>>> https://www.guru99.com/import-module-python.html
>>>>>>
>>>>>> But those are very simple examples and if I copy their structure they 
>>>>>> don't work for wx widgets.
>>>>>>
>>>>>> My project will use various widgets such as TreeCtrl, StyledTextCtrl, 
>>>>>> Toolbar and Menu. I thought I would put each of them into their own class 
>>>>>> file and import them into my main core python file (to keep file sizes 
>>>>>> down).
>>>>>>
>>>>>> Does that sound reasonable or should I just have the classes at the 
>>>>>> top of my main python file and not do the imports?
>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/c68cbbac-40cf-4c04-aa23-3ee5979ed3a8n%40googlegroups.com.