I have the following code: -
class MainFrame(wx.Frame):
-
def __init__(self, parent, id, title):
-
wx.Frame.__init__(self, parent, wx.ID_ANY, title,
-
style=wx.DEFAULT_FRAME_STYLE |wx.NO_FULL_REPAINT_ON_RESIZE)
-
# build top area
-
topSizer = self.buildTopPanel()
-
# build input area
-
inputSizer = self.buildInputPanel()
-
-
mainSizer = wx.BoxSizer(wx.VERTICAL)
-
mainSizer.Add(topSizer, 1, wx.EXPAND | wx.ALL, 5)
-
mainSizer.Add(inputSizer, 1, wx.EXPAND | wx.ALL, 5)
-
-
p = wx.Panel(self, wx.ID_ANY)
-
p.SetSizer(mainSizer)
-
-
s = wx.BoxSizer(wx.VERTICAL)
-
s.Add(p, 1, wx.EXPAND)
-
-
self.SetAutoLayout(True)
-
self.SetSizer(s)
-
self.Layout()
-
-
def buildTopPanel(self):
-
p = wx.Panel(self, wx.ID_ANY)
-
self.text = wx.TextCtrl(p, wx.ID_ANY, style=wx.TE_MULTILINE |
-
wx.SUNKEN_BORDER)
-
sizer = wx.BoxSizer(wx.HORIZONTAL)
-
sizer.Add(self.text, 1, wx.EXPAND)
-
return sizer
-
-
def buildInputPanel(self):
-
# the area to enter text
-
self.text2 = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_MULTILINE
-
| wx.SUNKEN_BORDER)
-
-
# panel to add button to
-
p = wx.Panel(self, wx.ID_ANY)
-
self.buttonClick = wx.Button(p, wx.ID_ANY, "Click")
-
hsizer = wx.BoxSizer(wx.HORIZONTAL)
-
hsizer.Add(self.buttonClick, 0, wx.ALIGN_CENTER)
-
p.SetSizer(hsizer)
-
-
# add the text control and button panel
-
box = wx.BoxSizer(wx.HORIZONTAL)
-
box.Add(self.text2, 1, wx.EXPAND)
-
box.Add(p, 0, wx.EXPAND)
-
return box
-
-
if __name__ == "__main__":
-
app = wx.PySimpleApp()
-
frame = MainFrame(None, wx.ID_ANY, "Test")
-
frame.Show()
-
app.MainLoop()
-
.....there are two problems.
1) i want the sizer (that is returned from buildTopPanel() ) to fill the
screen wide/tall. now the text control in it is very small in the
upper-left corner.
2) the scroll bars and borders on the text controls dont appear until i
mouse over them, any ideas?
thanks 1 1909
"py" <co*******@gmai l.com> wrote: I have the following code: ... ....there are two problems. 1) i want the sizer (that is returned from buildTopPanel() ) to fill the screen wide/tall. now the text control in it is very small in the upper-left corner.
2) the scroll bars and borders on the text controls dont appear until i mouse over them, any ideas?
The panel you create in buildTopPanel has not been added to any sizer. So,
you have the odd condition that the self.text control is controlled by a
sizer, but its parent panel is not. The layout is confused.
You need to build this up bit by bit. The frame gets a panel. The panel
is controlled by a sizer. The panel will contain other panels, added to
the parent panel's sizer. The inner panels may need their own sizers. The
controls owned by the inner panels need to be added to the inner sizers.
The borders don't appear because parts of the panels are overlapping them
in strange ways.
Several folks have suggested that you create the controls from the outside
in, making sure that the control ownership is correct, and then as a
separate step, add those controls to sizers from the inside out. That
works for me, but some kind of structure is needed to make sure that
ownership and sizership are handled completely.
You might try posting on the wxPython mailing list, http://www.wxpython.org/maillist.php.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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.
|
by: flupke |
last post by:
Hi,
i'm trying to convert my java console app to a python gui.
Now, the only problem i seem to have at the moment are the resizers
for the layout. It seems that for the purpose of what i'm trying to do,
specifying the coordinates is easier that fighting with the layout resizers.
1) I have a screen split in 2. Left side is a textcontrol where logging will
end up. All text will be appended to the textcontrol. Ideally this should
allow...
|
by: dcrespo |
last post by:
Hi all...
I think wxPython is much better than PyGTK. First of all, PyGTK needs
the GTK runtime installed, whereas wxPython is entirely Python's
modules, so It facilitates the apps' distribution. Also, PyGTK uses
specific controls or widgets of GTK, while wxPython uses native
controls of the platform where the app is running.
I'm learning both, but at a slow step, so I want to know all the
comments about this subject in this group.
|
by: Young H. Rhiu |
last post by:
See: http://hilug.org/img/app_layout.GIF
I'm implementing an album-like application with wxpython but I'm new to
wxPython though I know how to program with python. The problem is that
it's not easy for me to deal with drawing layout stuff with wxpython.
What layout I'm thinking of looks like the gif image above.
The application is about saving some comments for each pictures on the
filesystem. There are two windows. The above one is a...
|
by: Joe Strout |
last post by:
On Oct 23, 2008, at 11:50 AM, Stef Mientki wrote:
That's neat -- thank you for making it available. I've just recently
been working through some wxPython tutorials, and wondered if there
was a simple text-based layout definition format that would let me
define my interfaces in a simpler manner.
Your page says that the layout is defined in a docstring, but in the
sample code, it's actually just in a regular string literal. That's
| |
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...
|
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...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |