I am trying to fit a whole bunch of rows onto a notebook tab, that are
generated via a button. They all get bunched up, and I am just not
"seeing" my problem. I am wondering if you can help me get over this
hurdle. What I have is anywhere from 40-300 rows that I want to be
scrolled.
The rows consist of:
label_1 = wx.StaticText(self.panel_1, -1, fn, style=wx.ALIGN_LEFT |
wx.ALIGN_CENTRE)
checkbox_1 = wx.CheckBox(self.panel_1, -1, "")
choice_1 = wx.Choice(self.panel_1, -1, choices=['=', '!=', '<',
'<=', '>', '>=', 'contains'])
text_ctrl_1 = wx.TextCtrl(self.panel_1, -1, "")
choice_2 = wx.Choice(self.panel_1, -1, choices=['and', 'or'])
But they are getting all bunched up with no scrollbars.
Jerry
Here is the code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sun Jun 12 09:29:16 2011
import wx
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.notebook_1 = wx.Notebook(self, -1, style=0)
self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
self.panel_1 = wx.ScrolledWindow(self.notebook_1_pane_1, -1,
style=wx.TAB_TRAVERSAL)
self.button_1 = wx.Button(self, -1, "button_1")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.OnClick, self.button_1)
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("frame_1")
self.panel_1.SetScrollRate(10, 10)
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(3, 5, 10, 5)
sizer_1.Add(self.button_1, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.panel_1.SetSizer(grid_sizer_1)
sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
self.notebook_1_pane_1.SetSizer(sizer_2)
self.notebook_1.AddPage(self.notebook_1_pane_1, "tab1")
sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
self.gridsizer = grid_sizer_1
def OnClick(self, event): # wxGlade: MyFrame.<event_handler>
cols = [u'submitted_date', u'lock_version',
u'release_tested_in', u'sme_mcs2', u'saved_uniqueid',
u'cm_projectlockdate',
u'keywords', u'cm_rls_date', u'submitted_by',
u'doc_testeddate', u'cm_reworkdate', u'sme_version', u'state',
u'symptoms', u'platform', u'doc_docaffected',
u'script_done', u'customer_severity', u'is_active', u'est_hours',
u'testcaserework', u'doc_type', u'audio_done',
u'smng_content_review', u'doc_log', u'version_found_in', u'locked_by',
u'unduplicate_state', u'nottestable', u'build_status',
u'target_build', u'sme_contentrevision', u'smng_code_review',
u'old_id', u'cm_req_date', u'cm_se_date',
u'revised_lo', u'version', u'testcase_id', u'component',
u'cm_actualreleasedate', u'build_found_in',
u'is_duplicate', u'test_result', u'scm_history_log',
u'target_release',
u'doc_approveddate', u'headline', u'tested_by',
u'cm_tst_date', u'owner', u'previous_id', u'platform_tested_on',
u'opr_version_found', u'use_case',
u'scheduled_target_build', u'doc_entry', u'previous_submitter',
u'priority',
u'cm_uat_date', u'doc_partnumber', u'type',
u'usecasename', u'db_dbaffected', u'opr_longdescription',
u'opr_shortdescription', u'cloned_to',
u'previous_cm_tool', u'dev_team', u'atom', u'cm_cc_projectno',
u'assign_to', u'cm_deliverydate', u'project',
u'cm_deliveredto', u'auxnotes_log', u'functarea', u'mastered_by',
u'cm_seededfrom_actual', u'actual_hours',
u'test_purposes', u'id', u'cm_releasetype', u'cm_dev_date',
u'productline', u'severity', u'test_note_entry',
u'build_tested_in', u'art_done', u'closed_pm',
u'doc_translationneeded',
u'test_note_log', u'note_entry', u'product_name',
u'cm_suppl_release', u'cm_reworkfreq', u'description',
u'cloned_from', u'doc_editor', u'closed_scm',
u'doc_writer', u'notes_log', u'doc_usecase', u'cm_cc_projectlist',
u'cm_projectobsdate', u'submit_date', u'closed_qa',
u'cm_alt_stream_deliveries', u'browser_tested_on', u'history_log',
u'submitter', u'resolution', u'doc_status',
u'unique_id']
try:
self.columns = []
self.gridsizer.SetRows(len(cols))
self.gridsizer.SetCols(5)
for fn in cols:
label_1 = wx.StaticText(self.panel_1, -1, fn, style=wx.ALIGN_LEFT |
wx.ALIGN_CENTRE)
checkbox_1 = wx.CheckBox(self.panel_1, -1, "")
choice_1 = wx.Choice(self.panel_1, -1, choices=['=', '!=', '<',
'<=', '>', '>=', 'contains'])
text_ctrl_1 = wx.TextCtrl(self.panel_1, -1, "")
choice_2 = wx.Choice(self.panel_1, -1, choices=['and', 'or'])
items = [label_1, checkbox_1, choice_1, text_ctrl_1, choice_2]
self.columns.append(items)
self.gridsizer.Add(label_1, 1)
self.gridsizer.Add(checkbox_1, 1)
self.gridsizer.Add(choice_1, 1)
self.gridsizer.Add(text_ctrl_1, 1)
self.gridsizer.Add(choice_2, 1)
except:
pass
event.Skip()
# end of class MyFrame
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()