<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dabo.leafe.com/index.php?action=history&amp;feed=atom&amp;title=DPanel</id>
	<title>DPanel - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dabo.leafe.com/index.php?action=history&amp;feed=atom&amp;title=DPanel"/>
	<link rel="alternate" type="text/html" href="https://wiki.dabo.leafe.com/index.php?title=DPanel&amp;action=history"/>
	<updated>2026-11-22T00:59:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://wiki.dabo.leafe.com/index.php?title=DPanel&amp;diff=4104&amp;oldid=prev</id>
		<title>Ed: Created page with &quot;&#039;&#039;&#039;dPanel&#039;&#039;&#039; is a container for other controls. It is helpful in arranging controls into logical groupings. On Windows, it is required as the &quot;background&quot; of a form in order f...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.dabo.leafe.com/index.php?title=DPanel&amp;diff=4104&amp;oldid=prev"/>
		<updated>2020-05-12T20:43:50Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;dPanel&amp;#039;&amp;#039;&amp;#039; is a container for other controls. It is helpful in arranging controls into logical groupings. On Windows, it is required as the &amp;quot;background&amp;quot; of a form in order f...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;dPanel&amp;#039;&amp;#039;&amp;#039; is a container for other controls. It is helpful in arranging controls into logical groupings. On Windows, it is required as the &amp;quot;background&amp;quot; of a form in order for the form to look &amp;quot;normal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Some of the more useful properties for dPanel:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;BackColor&amp;#039;&amp;#039;&amp;#039; - (RGB tuple or color name string): The color for this panel. If you do not set this explicitly, its appearance is handled by the underlying UI toolkit, making the panel appear as a native part of the form.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;ActiveControl&amp;#039;&amp;#039;&amp;#039; - (dObject): Specifies which control in the panel has the keyboard focus.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Buffered&amp;#039;&amp;#039;&amp;#039; - (bool): If you are doing a lot of low-level drawing (see [[DrawObjects]]), setting this to &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; usually improves the performance of the drawings and reduces flicker. Default=&amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Example: Create a panel and add a control&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import dabo&lt;br /&gt;
dabo.ui.loadUI(&amp;quot;wx&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MainForm(dabo.ui.dForm):&lt;br /&gt;
    def afterInit(self):&lt;br /&gt;
        # Create an initial sizer to add to&lt;br /&gt;
        self.Sizer = dabo.ui.dSizer(&amp;quot;horizontal&amp;quot;)&lt;br /&gt;
        # Create a panel and add a control (in this case a label)&lt;br /&gt;
        pnl = self.Panel = dabo.ui.dPanel(self, BackColor=(255,200,200))&lt;br /&gt;
        pnl.addObject(dabo.ui.dLabel, Name=&amp;quot;MyLabel&amp;quot;,&lt;br /&gt;
                Caption=&amp;quot; I am a Label &amp;quot;, FontSize=24)&lt;br /&gt;
&lt;br /&gt;
        # add the panel to the sizer&lt;br /&gt;
        self.Sizer.append(pnl, &amp;quot;expand&amp;quot;, proportion=1, valign=&amp;quot;middle&amp;quot;)&lt;br /&gt;
        self.Sizer.layout()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    app = dabo.dApp()&lt;br /&gt;
    app.MainFormClass = MainForm&lt;br /&gt;
    app.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://web.archive.org/web/20110909131047/http://paul.dabodev.com/doc/api/dabodoc/ Dabo Class Documentation] for an exhaustive documentation of this control&amp;#039;s Properties and Methods. (Note that this documentation is no longer live, but it&amp;#039;s still available via the Internet Archive).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
If you really want to use the power of Dabo for a GUI display, you need to make even more use of Sizers. Sizers are one of the tricky things to come to grips with, but once you have, you will be away laughing.&lt;br /&gt;
&lt;br /&gt;
The Sizer stores a bunch of rules about how to display (layout) your controls on the screen. The Sizer is not the parent of your control. It is the containing object that is the parent to your control. Typically the first containing object is the Form, and the one after that is probably going to be a panel. And you may well want to use more than one panel on a professional looking page. You can set you controls in place with fixed dimensions, but life is much happier when you use another sizer.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Example of how to add a sizer to a panel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
# -*- coding: utf-8 -*-&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot; This sample code demonstrates how to add a sizer to a panel.&lt;br /&gt;
 In this example we create a dForm (MainForm) with a dSizer.&lt;br /&gt;
 On to this we add a dPanel (pnl), and a dSizer (psz).&lt;br /&gt;
 On to this we add two labels as examples of controls that could be added.&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
import dabo&lt;br /&gt;
dabo.ui.loadUI(&amp;quot;wx&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MainForm(dabo.ui.dForm):&lt;br /&gt;
    def afterInit(self):&lt;br /&gt;
        self.Sizer = dabo.ui.dSizer(&amp;quot;v&amp;quot;)            &lt;br /&gt;
        # self (MainForm) is the parent(containing object)using the property .Sizer&lt;br /&gt;
        pnl = self.Panel = dabo.ui.dPanel(self, BackColor=&amp;quot;Yellow&amp;quot;, FontSize=18)&lt;br /&gt;
        psz = pnl.Sizer = dabo.ui.dSizer(&amp;quot;h&amp;quot;)                   &lt;br /&gt;
        # pan.Sizer is the property to which this sizer is assigned&lt;br /&gt;
        lab1  = dabo.ui.dLabel(pnl, Caption=&amp;quot;One&amp;quot;)      &lt;br /&gt;
        # pan= self.Panel is the parent(containing object)&lt;br /&gt;
        # the sizer is not the parent. It is the parent&amp;#039;s rules.&lt;br /&gt;
        lab2  = dabo.ui.dLabel(pnl, Caption=&amp;quot;Two&amp;quot;)      &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;In a typical family Dad, Mum and the kids live in a home.&lt;br /&gt;
        The kids (children) belong to Dad &amp;amp; Mum (the Parents), and the Parents set the rules&lt;br /&gt;
        for how the children will behave.&lt;br /&gt;
        Sizer is a property of any Containing Object, which &amp;#039;stores the Rules&amp;#039; for how the&lt;br /&gt;
        child objects will be displayed (layed out).&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        psz.append1x(lab1)          # append the controls to the sizer which controls their layout&lt;br /&gt;
        psz.append1x(lab2)          # Note that append1x is a nice shortcut command&lt;br /&gt;
        self.Sizer.append1x(pnl)    # add the panel to the containing objects Sizer&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Then use either the controlling sizer or the Containing object &lt;br /&gt;
        to apply the layout rules&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        self.Sizer.layout()         # Apply the controlling sizer layout rules&lt;br /&gt;
        #self.layout()              # or we could have use the controlling object layout rules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    app = dabo.dApp()&lt;br /&gt;
    app.MainFormClass = MainForm&lt;br /&gt;
    app.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is common practice to use the controlling sizer rules way of expressing the layout command as it makes it very clear what we are trying to achieve. Python and Dabo are BIG on making things understandable.&lt;/div&gt;</summary>
		<author><name>Ed</name></author>
	</entry>
</feed>