473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

wxPython - 2 x foldpanelbar with tree...

Hello!
I have some trouble with my GUI. I have left panel with foldpanelbar,
but i need one item but not collapsed - simple button. I split my left
panel into two foldpanelbars with one button between.
But a have trouble...
Sorry for english :/
Simple code:

#------------------------------------------------------------------------------------------------------
import sys
import wx
import wx.html as html
import wx.lib.foldpanelbar as fpb
import os
import sys

ID_New = wx.NewId()
ID_Exit = wx.NewId()
#------------------------------------------------------------------------------
class MyMDIChildFrame(wx.MDIChildFrame):
#------------------------------------------------------------------------------
def __init__(self,parent,id,name=""):
wx.MDIChildFrame.__init__(self,parent, id, name)
self.InitGUI()
#--------------------------------------------------------------------------
def InitGUI(self):

#--------------------------------------------------------------------------
self.mainSplitter = wx.SplitterWindow(self, -1,
style=wx.SP_NOBORDER)
self.infoViewer = html.HtmlWindow(self.mainSplitter, -1,
style=wx.NO_FULL_REPAINT_ON_RESIZE)
#self.infoViewer.LoadPage("http://wxwidgets.org/manuals/2.5.4/
wx_wxbutton.html")
self.infoViewer.SetPage("Here is some <b>formatted</b>
<i><u>text</u></iloaded from a <font color=\"red\">string</font>.")
self.leftPanel = wx.Panel(self.mainSplitter)
self.CreateFoldPanel()
self.mainSplitter.Initialize(self.infoViewer)
self.mainSplitter.SplitVertically(self.leftPanel,
self.infoViewer, 180)
#--------------------------------------------------------------------------
def CreateFoldPanel(self):

#--------------------------------------------------------------------------

# foldpanel #1
self.foldPanel1 = fpb.FoldPanelBar(self.leftPanel, -1,
wx.DefaultPosition, wx.Size(-1,-1), fpb.FPB_DEFAULT_STYLE,
fpb.FPB_SINGLE_FOLD)
self.bs = wx.BoxSizer(wx.VERTICAL)
self.leftPanel.SetSizer(self.bs)
self.leftPanel.SetBackgroundColour(wx.BLACK)

item = self.foldPanel1.AddFoldPanel("Documents",
collapsed=False)
item.SetBackgroundColour(wx.RED)
button1 = wx.Button(item, wx.ID_ANY, "In")
button2 = wx.Button(item, wx.ID_ANY, "Out")
self.foldPanel1.AddFoldPanelWindow(item, button1)
self.foldPanel1.AddFoldPanelWindow(item, button2)

item = self.foldPanel1.AddFoldPanel("Projects", collapsed=False)
item.SetBackgroundColour(wx.BLUE)
button1 = wx.Button(item, wx.ID_ANY, "Name")
button2 = wx.Button(item, wx.ID_ANY, "Type")
button3 = wx.Button(item, wx.ID_ANY, "Data")
self.foldPanel1.AddFoldPanelWindow(item, button1)
self.foldPanel1.AddFoldPanelWindow(item, button2)
self.foldPanel1.AddFoldPanelWindow(item, button3)

item = self.foldPanel1.AddFoldPanel("Contacts", collapsed=False)
item.SetBackgroundColour(wx.CYAN)
button1 = wx.Button(item, wx.ID_ANY, "Name")
button2 = wx.Button(item, wx.ID_ANY, "Mail")
button3 = wx.Button(item, wx.ID_ANY, "City")
self.foldPanel1.AddFoldPanelWindow(item, button1)
self.foldPanel1.AddFoldPanelWindow(item, button2)
self.foldPanel1.AddFoldPanelWindow(item, button3)

self.bs.Add(self.foldPanel1, 0, wx.EXPAND)

# button
button1 = wx.Button(self.leftPanel, wx.ID_ANY, "Calendar")
self.bs.Add(button1, 0, wx.ALL|wx.EXPAND, 4)

# foldpanel #2
self.foldPanel2 = fpb.FoldPanelBar(self.leftPanel, -1,
wx.DefaultPosition, wx.Size(-1,-1), fpb.FPB_DEFAULT_STYLE,
fpb.FPB_SINGLE_FOLD)
item = self.foldPanel2.AddFoldPanel("Treenote", collapsed=True)
item.SetBackgroundColour(wx.GREEN)
self.tree = wx.TreeCtrl(item, wx.ID_ANY, wx.DefaultPosition,
wx.DefaultSize,wx.TR_HAS_BUTTONS| wx.TR_EDIT_LABELS|
wx.TR_HIDE_ROOT)#| wx.TR_MULTIPLE#| wx.TR_HIDE_ROOT)
self.foldPanel2.AddFoldPanelWindow(item, self.tree)
self.LoadTree()
self.bs.Add(self.foldPanel2, 0, wx.EXPAND)

self.foldPanel1.Bind(fpb.EVT_CAPTIONBAR, self.OnPressCaption)
self.foldPanel2.Bind(fpb.EVT_CAPTIONBAR, self.OnPressCaption)
self.bs.Fit(self)
self.bs.Layout()
self.foldPanel1.Layout()
self.foldPanel2.Layout()

#--------------------------------------------------------------------------
def OnPressCaption(self, event):

#--------------------------------------------------------------------------
self.bs.Layout()
event.Skip()
#--------------------------------------------------------------------------
def LoadTree(self):

#--------------------------------------------------------------------------
self.root = self.tree.AddRoot("The Root Item")
for x in range(15):
child = self.tree.AppendItem(self.root, "Test item %d" % x)
for y in range(5):
last = self.tree.AppendItem(child, "test item %d-%s" % (x,
chr(ord("a")+y)))
for z in range(5):
item = self.tree.AppendItem(last, "test item %d-%s-%d" %
(x, chr(ord("a")+y), z))
#------------------------------------------------------------------------------
class MyParentFrame(wx.MDIParentFrame):
#------------------------------------------------------------------------------

#--------------------------------------------------------------------------
def __init__(self):

#--------------------------------------------------------------------------
wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent",
size=(800,600))
self.winCount = 0
menu = wx.Menu()
menu.Append(ID_New, "&New Window")
menu.AppendSeparator()
menu.Append(ID_Exit, "E&xit")
menubar = wx.MenuBar()
menubar.Append(menu, "&File")
self.SetMenuBar(menubar)
self.CreateStatusBar()
self.my_canvas = None
self.Bind(wx.EVT_MENU, self.OnNewWindow, id=ID_New)
self.CreateNewWindow()
#--------------------------------------------------------------------------
def OnNewWindow(self, evt):

#--------------------------------------------------------------------------
self.CreateNewWindow()
#--------------------------------------------------------------------------
def CreateNewWindow(self):

#--------------------------------------------------------------------------
self.winCount = self.winCount + 1
win = MyMDIChildFrame(self, -1, "Child Window: %d" %
self.winCount)
win.Maximize()

if __name__ == '__main__':
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame = MyParentFrame()
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(False)
app.MainLoop()

Feb 26 '07 #1
1 2289
On 26 Feb 2007 06:50:11 -0800, "w.p." <pt****@tlen.plwrote:
>Hello!
I have some trouble with my GUI. I have left panel with foldpanelbar,
but i need one item but not collapsed - simple button. I split my left
panel into two foldpanelbars with one button between.
But a have trouble...
Sorry for english :/

Sorry, no answer.
Only the chance is much bigger you get one asking
in the wxpython mailing list.
Feb 27 '07 #2

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

Similar topics

1
by: Mark Carter | last post by:
Running xrced.py produced: Traceback (most recent call last): File "C:\Python23\Lib\site-packages\wxPython\tools\XRCed\xrced.py", line 28, in ? from tree import * # imports...
15
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...
12
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...
1
by: nuffnough | last post by:
Hi. I have a gui with one frame and 5 panels. The second panel will only be required in some cases, so I am wondering if there is some way I can only create this panel in the circumstances...
2
by: Kiran | last post by:
Hello all, I am using a tree to display stuff, and it is constantly updated, but what I have noticed is in the lowest level, there is clearly noticable cutoff of the text I place there. The cutoff...
2
by: OpenPavilion | last post by:
Hello, did anyone succeed in combining wxpython and a 3d engine (pyogre, crystalblend, panda3d, soya etc.) ? I would like to create an application, which uses wxpython tree, menu and grid...
1
by: Eric von Horst | last post by:
Hi, I need some advice on Drag&Drop. What I want to achieve is the following: - I have a window that is divided in two : on the left hand I have a wx.TreeCtlr and on the other hand a...
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread...
3
by: azrael | last post by:
I need to implement a tree which will append a root. Any other node in the tree will be triggered when a button is pressed. I created the button, all the needed events, tree and a root. But when I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.