What can I do to this code to keep the layout from looking line
button button button grid
or worse
button
button
button
grid
I need something like
grid
button button button
I was trying to use the splitter example but couldn't get it to work. I am using python 2.5 and the latest wxwindows. Thanks for the help in advance -
-
):
-
-
wx.Frame.__init__(self, parent, -1, "Dex Tracker Score Editor", size=(640,480))
-
p = wx.Panel(self, -1, style=0)
-
self.grid = WordGrid(p, log)
-
b = wx.Button(p, -1, "Save Grid") #b gets numbered per button and then description set
-
b2 = wx.Button(p, 100, "Add Line")
-
b3 = wx.Button(p, -1, "Insert Line")
-
b4 = wx.Button(p, -1, "Delete Line")
-
b5 = wx.Button(p, -1, "Play from line to line")
-
-
b.SetDefault()
-
self.Bind(wx.EVT_BUTTON, self.OnButton, b) #bind to the button I am numbering them
-
self.Bind(wx.EVT_BUTTON, self.OnButton2, b2)
-
self.Bind(wx.EVT_BUTTON, self.OnButton3, b3)
-
self.Bind(wx.EVT_BUTTON, self.OnButton4, b4)
-
self.Bind(wx.EVT_BUTTON, self.OnButton5, b5)
-
b.Bind(wx.EVT_SET_FOCUS, self.OnButtonFocus) #bind button focus if needed
-
#bs = wx.BoxSizer(wx.ALIGN_BOTTOM)
-
#bs = wx.StaticBoxSizer(wx.
-
bs = wx.BoxSizer(wx.HORIZONTAL)#(wx.VERTICAL)#|wx.ALIGN _BOTTOM) #(wx.HORIZONTAL_HATCH) #(wx.VERTICAL)
-
#bs.Add(self.grid, 1, wx.GROW|wx.ALL, 5)
-
bs.Add(b) #add the button here numbered in par
-
bs.Add(b2)
-
bs.Add(b3)
-
bs.Add(b4)
-
bs.Add(b5)
-
#p.placed
-
bs = wx.BoxSizer(wx.VERTICAL)
-
bs.Add(self.grid, 1, wx.GROW|wx.ALL, 5)
-
p.SetSizer(bs)
-
-
4 2578
This thread will be renamed to include the word "grid sizers" for future reference.
I need something like
grid
button button button
One sizer holds the panel. The panel gets a GridBagSizer which lets you do things like span multiple columns. -
Boa:Frame:Frame1
-
-
import wx
-
import wx.grid
-
-
def create(parent):
-
return Frame1(parent)
-
-
[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1BUTTON3, wxID_FRAME1GRID1,
-
wxID_FRAME1PANEL1,
-
] = [wx.NewId() for _init_ctrls in range(6)]
-
-
class Frame1(wx.Frame):
-
def _init_coll_gridBagSizer1_Items(self, parent):
-
# generated method, don't edit
-
-
parent.AddWindow(self.button1, (1, 0), border=0, flag=wx.ALIGN_CENTER, span=(1, 1))
-
parent.AddWindow(self.button2, (1, 1), border=0, flag=wx.ALIGN_CENTER, span=(1, 1))
-
parent.AddWindow(self.button3, (1, 2), border=0, flag=wx.ALIGN_CENTER, span=(1, 1))
-
parent.AddWindow(self.grid1, (0, 0), border=0, flag=wx.GROW | wx.EXPAND, span=(1, 3))
-
-
def _init_coll_boxSizer1_Items(self, parent):
-
# generated method, don't edit
-
-
parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND)
-
-
def _init_sizers(self):
-
# generated method, don't edit
-
self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
-
-
self.gridBagSizer1 = wx.GridBagSizer(hgap=0, vgap=0)
-
-
self._init_coll_boxSizer1_Items(self.boxSizer1)
-
self._init_coll_gridBagSizer1_Items(self.gridBagSizer1)
-
-
self.SetSizer(self.boxSizer1)
-
self.panel1.SetSizer(self.gridBagSizer1)
-
-
def _init_ctrls(self, prnt):
-
# generated method, don't edit
-
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(485, 430),
-
size=wx.Size(400, 250), style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
-
self.SetClientSize(wx.Size(392, 223))
-
-
self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self, pos=wx.Point(0, 0),
-
size=wx.Size(392, 223), style=wx.TAB_TRAVERSAL)
-
-
self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1', name='button1',
-
parent=self.panel1, pos=wx.Point(27, 201), size=wx.Size(75, 23), style=0)
-
-
self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label='button2', name='button2',
-
parent=self.panel1, pos=wx.Point(157, 201), size=wx.Size(75, 23), style=0)
-
-
self.button3 = wx.Button(id=wxID_FRAME1BUTTON3, label='button3', name='button3',
-
parent=self.panel1, pos=wx.Point(287, 201), size=wx.Size(75, 23), style=0)
-
-
self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1, name='grid1', parent=self.panel1,
-
pos=wx.Point(0, 0), size=wx.Size(390, 201), style=0)
-
-
self._init_sizers()
-
-
def __init__(self, parent):
-
self._init_ctrls(parent)
Actually, Eric, I've gotten fed up with trying to get sizers to work right. What I do is used fixed sized windows and absolute (x, y) positioning of the widgets. Of course, using a gui gernerator (like wxGlade, ect ( see my post on IDE choices)) makes this much easier.
Actually, Eric, I've gotten fed up with trying to get sizers to work right. What I do is used fixed sized windows and absolute (x, y) positioning of the widgets. Of course, using a gui gernerator (like wxGlade, ect (see my post on IDE choices)) makes this much easier.
I saw the gui builder for sale (you know the stick figure with the big nose like mine) but I don't have the cash for such things. I was hopeing for a simple way to changing the generated code over to the format I want. What I would realy like is a way to change direction while the display is being built. I don't care if I use a sizer or another method. Using excel as an alternative method looks intresting but it isn't what I was after.
ie from bs = wx.BoxSizer(wx.HORIZONTAL) to bs = wx.BoxSizer(wx.VERTICAL) while I am building the display.
I saw the gui builder for sale (you know the stick figure with the big nose like mine) but I don't have the cash for such things. I was hopeing for a simple way to changing the generated code over to the format I want. What I would realy like is a way to change direction while the display is being built. I don't care if I use a sizer or another method. Using excel as an alternative method looks intresting but it isn't what I was after.
ie from bs = wx.BoxSizer(wx.HORIZONTAL) to bs = wx.BoxSizer(wx.VERTICAL) while I am building the display.
wx.VERTICAL and wx.HORIZONTAL are flags in the Style "constructor" arguement. On all wx widgets that I've looked at so far, there are no commands that change the style on the fly (after it has been created). The proper technique is to put sizers inside sizers. It easy (I take back what I said earlier, after playing with this) to get good results this way. Make a vertical sizer with a horizontal box sizer in it which gets you buttons added to it. The only other item that the horizontal sizer is in charge of is your grid.
There are lots of free tools (I don't recall any commercial products in my list).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Deltones |
last post by:
Hi,
I'm trying to understand one of the wiki wxPython tutorial, and I must
admit I`m a bit baffled by sizers. If I run the following relevant
piece of code, I get the result I expect, i.e a...
|
by: Ashok |
last post by:
hi,
I am trying to build a small gui program in python using boa
constructor. i have a few problems. i would be grateful if anyone can
help me in this regard.
1. i have four static text controls...
|
by: JAPHET |
last post by:
I am Trying to Format date in my Datagrid to SHORTDATE format with the
following codes,
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As...
|
by: Tina |
last post by:
I have a datagrid where I specified {0:###,###,###} at design time. However
sometimes I am putting percentages in the grid instead of money and I want
to change the formating to {##%}. I've...
|
by: Jack M |
last post by:
I have a large data grid with several rows that contain dates. I want to display the date only(no time). Even when I use the trunc function in Oracle the rows show a time of 12:00:00 am.
What I...
|
by: Jordan |
last post by:
Hey Peoples,
I'm wonderg if there is a way to make a subclass of wx.grid.Grid in
which the coloumn labels for the grid appear on the bottom of the grid
instead of the top.
1 2 3 4 5
a| | ...
|
by: shbrittan |
last post by:
I need to have my users type in instructions in either plain text or with imbedded html tags at their choice. The typed data along with other columns are stored in a sql database, then displayed in...
|
by: BH |
last post by:
Hi !
I have a small problem with wx.Grid and scrollbars.
Scrollbars definitively dissapears after resizing the frame.
Thx for help
...
|
by: Astan Chee |
last post by:
Hi,
I have a wxNoteBook with a bunch of wxPanels attached to it as pages.
Every page has its own GUI items.
What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to
be resized...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |