|
|
|
Return to Code Snippets
by astelix » Wed Dec 17, 2008 12:28 pm
The idea is to have a startup shell (I call it 'pod') to begin from scratch a panda3d application using the power of Wxwidgets to ease as much as possible the job.
The stuff is known to work on panda3D 1.5.4 and 1.6.x on a linux desktop and on windowsXP with python 2.5 or 2.6 and WxWidgets 2.7.8 and 2.8.9
Download the package here:
p3dwxpod.zip
Create a folder on your hard disk and unpack into it the whole stuff and start it using run.sh on linux or run.bat on windows or issuing from console - Code: Select all
python p3dwxpod.py
Enjoy.
Last edited by astelix on Tue May 05, 2009 4:00 pm, edited 15 times in total.
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by rdb » Wed Dec 17, 2008 12:44 pm
I should point out that there's a similar thing to this available already in the Panda3D source code. It's called the WxAppShell and it will be available in 1.6.0 and later. This code looks more or less like the WxAppShell though -- what is exactly the difference between them?
I should also mention that (in case you took code from either the WxAppShell or the Panda3D Editor from the other thread) the BSD license (afaik) does not permit relicensing (even if you specify "no license") with or without modified code.
I prefer e-mail over PM
-
rdb
-
- Posts: 8549
- Joined: Mon Dec 04, 2006 5:58 am
- Location: Netherlands
-
by astelix » Wed Dec 17, 2008 12:57 pm
pro-rsoft wrote:I should point out that there's a similar thing to this available already in the Panda3D source code. It's called the WxAppShell and it will be available in 1.6.0 and later. This code looks more or less like the WxAppShell though -- what is exactly the difference between them?
I should also mention that (in case you took code from either the WxAppShell or the Panda3D Editor from the other thread) the BSD license (afaik) does not permit relicensing (even if you specify "no license") with or without modified code.
Yes i saw it and that inspired me this but this it very different - that was an empty wx shell with just a base.userExit() P3D code and mine is a complete and working environment where you can start from scratch coding you P3D app without doing anything else. I hope the fact it have a similar menu and about messagebox will not raise licensing issues...
Anyway I'm curious to know what David think about it
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by rdb » Wed Dec 17, 2008 1:07 pm
No, don't worry. I didn't notice this class actually also shows a Panda3D window inside the Wx window. It looks useful to start with.
I prefer e-mail over PM
-
rdb
-
- Posts: 8549
- Joined: Mon Dec 04, 2006 5:58 am
- Location: Netherlands
-
by Laurens » Wed Dec 17, 2008 1:17 pm
Thanks! Very nice example. I notice that when the about dialog shows, panda3d is no longer updated.
-
Laurens
-
- Posts: 145
- Joined: Sat Sep 23, 2006 5:08 am
by astelix » Wed Dec 17, 2008 3:48 pm
thankyou Laurens.
Yes indeed is so 'cos the about messagebox is opened in blocking mode - closing it you'll start again where you were so you won't miss anything of your app.
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by Nemesis#13 » Wed Dec 17, 2008 4:04 pm
thank you very much astelix!
i'm sure, i'll find use for that code 
-

Nemesis#13
-
- Posts: 1041
- Joined: Mon Aug 04, 2008 8:09 pm
- Location: Germany
by astelix » Wed Dec 17, 2008 4:15 pm
Nemesis#13 wrote:thank you very much astelix! i'm sure, i'll find use for that code 
 this is what I hope for - good coding and dont forget to share it to us
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by ynjh_jo » Wed Dec 17, 2008 7:21 pm
Laurens wrote:I notice that when the about dialog shows, panda3d is no longer updated.
That's why I spawn modal dialog in a new thread.
-

ynjh_jo
-
- Posts: 1795
- Joined: Tue Apr 18, 2006 12:41 am
- Location: Malang, Indonesia
-
by Derek » Fri Dec 19, 2008 1:04 pm
I have used your code well, thanks for it.
I created a wx.Frame decendant which allows you to have multiple frames open on the same or different parent window.
I have finally managed to set up a nodepath attached to the camera node of each frame upon which a gui is rendered with scale set like aspect2d to duplicate the wx coordinate system.
Also I have attached a 3d model underneath the mouse cursor (or in place of) which, along with the other hud items (which are soon to be click3d/drag3dable) is also parented under the perspective lense of the frames camera nodepath to allow 3d scenes to look more realistic when viewed as hud items.
The source will be put to use in my current project ($) so I wont be releasing it unles you post which specific project of yours it is for.
Next I plan to find a way to autogenerate all of the widget classes using the other half of the project - an app designer/compiler which uses my panel3d for the interface. I am planning on using a ZUI.
-

Derek
-
- Posts: 19
- Joined: Tue Mar 18, 2008 3:22 pm
- Location: Ontario, Canada
by astelix » Fri Dec 19, 2008 5:17 pm
I actually ain't get where you are planning to go Derek, but sound you're starting something big. I'm looking forward to see it when you got some to show.
About my piece of code, it is not intended to develop any particular project but to have a generic starting point to build p3d apps with the commodity of wxWindows library and as less effort as possible.
Soon I'll post an update with new stuff so stay tuned!
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by Derek » Fri Dec 19, 2008 9:22 pm
-

Derek
-
- Posts: 19
- Joined: Tue Mar 18, 2008 3:22 pm
- Location: Ontario, Canada
by astelix » Sun Dec 21, 2008 11:19 am
nice stuff Derek! this is something I would do by myself sooner or later but if you got some to share do not hesitate to send me or post here - if I think that could be useful I'll fit into the project.
People, as I said before I got a first less drafty revision of this snippet. I have tons of ideas to add but for now I guess could be a nice start.
Check the first post of this thread, download and play and maybe tellme what you think about.
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by astelix » Tue May 05, 2009 11:35 am
A new version is up - beside several fixes now it runs nice on windows as well as linux.
Go here to download the stuff.
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by pbouf » Wed May 06, 2009 11:57 am
I just tried the new version and it segfaults:
- Code: Select all
patrick@t40puter:~/Desktop/p3dwxpod$ python p3dwxpod.py DirectStart: Starting the game. :util: Reading /home/patrick/Desktop/p3dwxpod/config/p3dwxpod.prc >>>opening p3dsurface :display: loading display module: libpandagl.so Known pipe types: glxGraphicsPipe (all display modules loaded.) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadWindow (invalid Window parameter) :display:glxdisplay(error): BadDrawable (invalid Pixmap or Window parameter) :display:glxdisplay(error): BadValue (integer parameter out of range for operation) Segmentation fault
My own panda-only stuff is working fine. Now, I've been having some issues with graphics drivers since I upgraded to Ubuntu 9.04 (Jaunty Jackalope) so that might be the cause.
-
pbouf
-
- Posts: 25
- Joined: Sat Nov 29, 2008 1:43 am
by rdb » Wed May 06, 2009 12:14 pm
I'm getting similar errors too (GLXBadDrawable), it happens because panda's window gets reparented before the wx window is fully opened.
In p3dwxpod.py, replace the line that says "self.init_end()" with something like this:
- Code: Select all
taskMgr.doMethodLater(0.5, self.init_end, "blah", extraArgs=[])
That makes sure it opens 0.5 seconds later. Would be cleaner to have an onOpen event or so.
PS. Nice work, the wxpod. I like it. Maybe we should have something like this in pview. 
I prefer e-mail over PM
-
rdb
-
- Posts: 8549
- Joined: Mon Dec 04, 2006 5:58 am
- Location: Netherlands
-
by astelix » Thu May 07, 2009 3:40 am
*squish* the bug correctly pointed out by the always precious pro_rsoft has gone, BUT looks like there is more: in my rig 2 (see my signature) the Ubuntu flavor, I can't say if it is a matter of something changed in the P3D 1.6 or the ATI drivers but I'm experiencing a bad behavior whit the Panda overlay (either using my pod or the usual panda window) revealing out whatever window I put in front of it and therefore the wx menus are not visible 'cos are covered by the P3d overlay. Download again the pod and see for yourselves.
pro-rsoft wrote:PS. Nice work, the wxpod. I like it. Maybe we should have something like this in pview. 
hey thankyo dude, I'm glad you like it - would you believe I started to make it to replace pview? then the little snippet has grown since then - it is under the hood of my p3ddojo - but it is open enough to make any kind of p3d app.
My Rig: P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
-

astelix
-
- Posts: 866
- Joined: Mon Mar 27, 2006 4:36 pm
- Location: Milano, ITA
by pbouf » Thu May 07, 2009 7:25 am
@astelix: In fact that's the very problem I was talking about (with graphics drivers), I also have an ATI card (and I can't do anything about it, it's a laptop..). I filed this bug if you want to take a look: http://bugs.freedesktop.org/show_bug.cgi?id=21600
-
pbouf
-
- Posts: 25
- Joined: Sat Nov 29, 2008 1:43 am
by kbogert » Mon Apr 18, 2011 10:47 pm
Thanks for this wonderful class! I've found a bug, on linux at least:
In p3dwxpod.py, line 169:
- Code: Select all
if self.wxevt_loop.Pending(): self.wxevt_loop.Dispatch()
Should be: - Code: Select all
while self.wxevt_loop.Pending(): self.wxevt_loop.Dispatch()
This bug causes menu interaction to be painfully slow.
Thanks again!
-
kbogert
-
- Posts: 1
- Joined: Mon Apr 18, 2011 10:44 pm
Return to Code Snippets
Who is online
Users browsing this forum: No registered users and 0 guests
| | |