473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[wxPython] How to rebuild a page containing controls because some of them have to be deleted?

I often use Notebook to structure my GUIs. Sometimes I have to provide a
Settings page. Doing changes in this page influences other pages in such a
way, that some controls have to change add or remove children or even have
to be removed from the page at all.

Yet I could not come up with a solid pattern how to do this. I tried to call
DestroyChildren (), delete all ref's to them, and to set the page's sizer to
None. This doesn't work very well. When I rebuild the page, at least the
arrangement of the controls is not the same as before, which makes me think,
that other things will go wrong in the long run too.

For now I issue a dialog telling the user, that he has to restart the app -
not very professional looking...

So, how is this done best?

Kind regards
Franz GEIGER
Jul 18 '05 #1
2 1544
On Fri, 2004-10-29 at 20:51 +0200, F. GEIGER wrote:
I often use Notebook to structure my GUIs. Sometimes I have to provide a
Settings page. Doing changes in this page influences other pages in such a
way, that some controls have to change add or remove children or even have
to be removed from the page at all.

Yet I could not come up with a solid pattern how to do this. I tried to call
DestroyChildren (), delete all ref's to them, and to set the page's sizer to
None. This doesn't work very well. When I rebuild the page, at least the
arrangement of the controls is not the same as before, which makes me think,
that other things will go wrong in the long run too.


I use this technique with little issue (although I haven't tried it with
a wx.Notebook). One thing you might try is to use an extra wx.Panel as
a container for the entire page. So each page then would end up with a
single panel for the page, and each panel further containing *another*
single panel which contains your actual controls. This way you can
simply destroy the second panel and recreate it and the layout is simple
enough that you shouldn't run into problems with sizers getting
confused.

Regards,
Cliff

--
Cliff Wells <cl************ @comcast.net>

Jul 18 '05 #2

"Cliff Wells" <cl************ @comcast.net> schrieb im Newsbeitrag
news:ma******** *************** *************** @python.org...
On Fri, 2004-10-29 at 20:51 +0200, F. GEIGER wrote:
I often use Notebook to structure my GUIs. Sometimes I have to provide a
Settings page. Doing changes in this page influences other pages in such a way, that some controls have to change add or remove children or even have to be removed from the page at all.

Yet I could not come up with a solid pattern how to do this. I tried to call DestroyChildren (), delete all ref's to them, and to set the page's sizer to None. This doesn't work very well. When I rebuild the page, at least the
arrangement of the controls is not the same as before, which makes me think, that other things will go wrong in the long run too.
I use this technique with little issue (although I haven't tried it with
a wx.Notebook). One thing you might try is to use an extra wx.Panel as
a container for the entire page. So each page then would end up with a
single panel for the page, and each panel further containing *another*
single panel which contains your actual controls. This way you can
simply destroy the second panel and recreate it and the layout is simple
enough that you shouldn't run into problems with sizers getting
confused.


I thought about an extra panel too, shouldn't be a problem with Notebook
either. So if this is how it is done, I'll go for it.

Regards,
Cliff

Many thanks for your quick reply!

Kind regards
Franz

--
Cliff Wells <cl************ @comcast.net>

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
2907
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems to be more low-level than the other GUI toolkits I've used (Tk, GTK, and Trestle), and there are all sorts exposed details in wxWindows/wxPython that I find weird.
6
1967
by: Batista, Facundo | last post by:
I'm still deciding about using Tkinter or wxPython for a project I have (sigefi, on SF). The decision is not made, I have to finish first a little program that will be done in both GUIs, and then make a choice (I'll write something about the experiment, I'll let you know). In this context, I got worried when a friend of mine (codeveloper of sigefi) could not install PyNSource because wxPythonGTK been always using private methods from...
7
3683
by: Kersh | last post by:
I'm trying to implement XHTML standards in my ASP.NET web pages but whenever I use web controls I get problems because of the very strict nature of W3C XHTML (transitional version is picky but strict1.1 very severe!) e.g. align="Center" fails validation because of the capital "C" - this makes asp:Calendar control unuseable because it happens to use this tag for each of the cells. Also Javascript tags require a 'type' attribute...etc
2
3625
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
12
1852
by: vivainio | last post by:
I rarely do GUIs, and reminded myself today why that is the case (simply, it's not fun). I implemented a simple TreeCtrl, and had to implement my own 'children' method, of all things! Here it is: def children(self,node): c =
1
6079
by: Grant | last post by:
Hi, I am looking for a tip. I have a panel and a checkbox. When I check the checkbox, I would like to add buttons to the panel (dynamically). When the checkbox is unchecked, the buttons should not appear (be deleted)---all the while, the window should resize if necessary. If you have a simpler example, that is fine. I just need a hint as to how you dynamically change the widgets and their layouts. Looking at the wx demos, there is...
6
1842
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and unpacking the wxPython demo program. It appears to run after a fashion, but I also get this at the commandline. Any help much appreciated. (python:5865): Gtk-CRITICAL **: gtk_window_realize_icon: assertion
4
2645
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. - Why is this happening? - Can I disable automatic declaration and have everything be declared manually? - Any other options to fix this? Thanks in advance. Goran Djuranovic
16
7242
by: Wayne | last post by:
I've read that one method of repairing a misbehaving database is to save all database objects as text and then rebuild them from the text files. I've used the following code posted by Lyle Fairfield to accomplish the first step: Private Sub SaveObjectsAsText() path = CurrentProject.path & "\ObjectsAsText\" SaveDataAccessPagesAsText SaveFormsAsText SaveReportsAsText
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.