Hi friends,
Please look at the screenshot and examine source code I provide. Problem is: I don't know how to insert (correctly) CalendarCtrl widget into xrc frame. I rely on yours help!
Thank in advance!
hercules.xrc (9 KB)
test.py (2.24 KB)
Hi friends,
Please look at the screenshot and examine source code I provide. Problem is: I don't know how to insert (correctly) CalendarCtrl widget into xrc frame. I rely on yours help!
Thank in advance!
hercules.xrc (9 KB)
test.py (2.24 KB)
Basil Shubin <bashu <at> yandex.ru> writes:
Hi friends,
Please look at the screenshot and examine source code I provide. Problem
is: I don't know how to insert (correctly) CalendarCtrl widget into xrc
frame. I rely on yours help!
Have a careful look on what is the parent of the unkwon control when you call
AttachUnknownControl. E.g. in test.py you pass the top level frame as parent to
WorkoutsCalendar but it should be the notebook page (which is a panel).
Christian
Christian Kristukat wrote:
Basil Shubin <bashu <at> yandex.ru> writes:
Hi friends,
Please look at the screenshot and examine source code I provide. Problem is: I don't know how to insert (correctly) CalendarCtrl widget into xrc frame. I rely on yours help!
Have a careful look on what is the parent of the unkwon control when you call
AttachUnknownControl. E.g. in test.py you pass the top level frame as parent to
WorkoutsCalendar but it should be the notebook page (which is a panel).
After I make changes it still look weird... What is my mistake? See attachment.
hercules.xrc (9.02 KB)
test.py (2.32 KB)
In continuing of this topic... I create two unknown widget in XRCed and want embed some controls in to it (TimeCtrl in this case), but problem is (as you can see on the screenshot) that the TimeCtrl was cliped by size of unknown widget from xrc. What shall I do, each time set the proper size of unknown control so embeded control fits into it smoothly (its look very boring and broke the idea of rapid developing I think) or is there some way to make unknown control automaticaly shrink/expand for size of embeded widget, but how to achieve this? Rely on yours help!
Thanks in advance!
hercules.xrc (9.01 KB)
test.py (2.8 KB)
Best create your own XML handler to create the ressources you want. That way
you have full control over how/what is created.
Check out
http://wxwidgets.org/manuals/2.6.3/wx_wxxmlresourcehandler.html#wxxmlresourcehandler
I think there are also examples somewhere. Essentially you can look into the
wxpython sources in the xrc section - there are all the default handlers for
the usual types.
Hope that helps.
UC
On Saturday 22 July 2006 20:18, Basil Shubin wrote:
In continuing of this topic... I create two unknown widget in XRCed and
want embed some controls in to it (TimeCtrl in this case), but problem
is (as you can see on the screenshot) that the TimeCtrl was cliped by
size of unknown widget from xrc. What shall I do, each time set the
proper size of unknown control so embeded control fits into it smoothly
(its look very boring and broke the idea of rapid developing I think) or
is there some way to make unknown control automaticaly shrink/expand for
size of embeded widget, but how to achieve this? Rely on yours help!Thanks in advance!
--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416
On this page http://wiki.wxpython.org/index.cgi/UsingXmlResources I found following note, cite it:
...
Note: If you set the sizer flag wxADJUST_MINSIZE on the unknown control and call wxSizer.Fit(), it will correctly resize the control and relayout everything to match. In my version of xrced, this sizer flag is not available in the menu, but you can type it in anyway. The manual method below is not needed. (I suggest the page owner remove it.) -- Reid Priedhorsky 2005-07-09
...
But I can't realise how to apply it on example I provide... Please, need your help!
Basil Shubin wrote:
Hi friends,
Please look at the screenshot and examine source code I provide. Problem is: I don't know how to insert (correctly) CalendarCtrl widget into xrc frame. I rely on yours help!
The way that unknown controls work is that a panel is created in that place in the xrc, and when you call AttachUnknownControl then the widget that you pass to it is reparented to that panel. There are some issues with this approach with some controls. For example since the calendar is composed of multiple widgets only the main one gets reparented and the others are left behind on the original parent. You can use the wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION style to tell the calendar to not use the extra controls.
Your other problem you saw with the TimeCtrl is probably due to the sizer used on that unknown panel. It may be sensing the min size of the TimeCtrl incorrectly or something. The best way to do it is to avoid the unknown control approach and use your own custom handlers as Uwe suggested. Then there is no other panel in between that you have no control over.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Its me again with stupid question!
Here I am trying adopt the XmlResourceSubclass and figuring how to use it my existing xrc resource. For this moment I only have error also examine attached file.
Error is:
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!
hercules.xrc (34.1 KB)
test.py (2.79 KB)
Basil Shubin wrote:
Its me again with stupid question!
Here I am trying adopt the XmlResourceSubclass and figuring how to use it my existing xrc resource. For this moment I only have error also examine attached file.
Error is:Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!<object class="wxPanel" name="startTime" subclass="WorkoutTime">
The subclass factory needs to know how to find your class, and so you need to specify any package/module names needed to find it. It will do an import of the module specified and then get the class from it.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin Dunn wrote:
Basil Shubin wrote:
Its me again with stupid question!
Here I am trying adopt the XmlResourceSubclass and figuring how to use it my existing xrc resource. For this moment I only have error also examine attached file.
Error is:Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!<object class="wxPanel" name="startTime" subclass="WorkoutTime">
The subclass factory needs to know how to find your class, and so you need to specify any package/module names needed to find it. It will do an import of the module specified and then get the class from it.
Don't know how to specify this... How I can apply that what you say on the above example. I am confused.
Thanks for any help!
Robin Dunn wrote:
Basil Shubin wrote:
Its me again with stupid question!
Here I am trying adopt the XmlResourceSubclass and figuring how to use it my existing xrc resource. For this moment I only have error also examine attached file.
Error is:Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/xrc.py", line 727, in Create
assert className.find('.') != -1, "Module name must be specified!"
AssertionError: Module name must be specified!<object class="wxPanel" name="startTime" subclass="WorkoutTime">
The subclass factory needs to know how to find your class, and so you need to specify any package/module names needed to find it. It will do an import of the module specified and then get the class from it.
Doh! I almost create working widget, but there exist two other problem (see screenshot and examine sources):
1. The Xml subclass I have insert into xrc resource file doesn't want center by vertical. How how to make so?
2. Left custom control overlap the text label. What is right solution for cases like this?
Thanks for yours help!
hercules.tar.gz (3.87 KB)