0
votes

I'm using wxpython to code this simple form. A notebook with a scroll bar and few text controls is what i have used.I can see the widgets which are view-able on screen but the ones which needs to be scrolled down are not visible. In my code below i could see upto "Enter the Logs" and appropriate text control for that fields but the "review fields are missing along with submit and cancel buttons.

import wx

import wx.lib.filebrowsebutton as filebrowse

class Frame ( wx.Frame ):

def __init__( self, parent ):
    wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Test", pos = wx.DefaultPosition, size = wx.Size( 600,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

    self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
    sizer = wx.BoxSizer( wx.VERTICAL )

    self.notebook = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
    self.login = wx.Panel( self.notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
    self.notebook.AddPage( self.login, u"Login", False )
    self.scroll = wx.ScrolledWindow( self.notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL )
    vbox = wx.BoxSizer(wx.VERTICAL)

    # Sizer for widgets inside tabs
    inside_sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h3 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h4 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h5 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h6 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h7 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h8 = wx.BoxSizer(wx.HORIZONTAL)
    inside_sizer_h9 = wx.BoxSizer(wx.HORIZONTAL)

    #Test Approve Label
    self.test_app_label = wx.StaticText(self.scroll, -1 , label="Test Approved By :")
    inside_sizer_h1.Add(self.test_app_label, 1,  wx.ALL,5)

    #Test Approve Combo   
    self.tes_app_combo = wx.ComboBox(self.scroll, -1, value='None', choices= ['None', 'approver1', 'approver2', 'approver3', 'approver4'] )
    inside_sizer_h1.Add(self.tes_app_combo, 1, wx.ALL, 5 )


    #Workspace Label
    self.wrksp_label =  wx.StaticText(self.scroll, -1 , label="Workspace :")
    inside_sizer_h2.Add(self.wrksp_label, 1,  wx.ALL,5)

    #Workspace file selector
    self.select_wrksp_dir = filebrowse.DirBrowseButton(self.scroll, -1,labelText = "", toolTip = 'Select tip of your workspace')
    inside_sizer_h2.Add(self.select_wrksp_dir,  1, wx.ALL|wx.EXPAND, 5 )

    # Issuelist label
    self.ar_list_label = wx.StaticText(self.scroll, -1 , label="Issue List :")
    inside_sizer_h3.Add(self.ar_list_label, 1,  wx.ALL,5)

    # Issue Text box
    self.ar_list_text =  wx.TextCtrl(self.scroll, -1, value=u"Enter The issue, one per line", style=wx.TE_MULTILINE)
    inside_sizer_h3.Add(self.ar_list_text,  1, wx.ALL, 5 )

    # Summary of change Title
    self.change_summary_label = wx.StaticText(self.scroll, -1 , label=u"Summary of change :")
    inside_sizer_h4.Add(self.change_summary_label, 1,  wx.ALL, 5)

    # Summary of change Text Box
    self.change_summary_text =  wx.TextCtrl(self.scroll, -1, value=u"What componet has changed?",style=wx.TE_MULTILINE)
    inside_sizer_h4.Add(self.change_summary_text,  1, wx.ALL, 5 )

    # Changed File List Title
    self.change_file_list_label = wx.StaticText(self.scroll, -1 , label=u"Changed File List :")
    inside_sizer_h5.Add(self.change_file_list_label,1,  wx.ALL, 5)

    # Changed File List Box
    self.change_summary_text =  wx.TextCtrl(self.scroll, -1, u' enter list of changed files',style=wx.TE_MULTILINE)
    inside_sizer_h5.Add(self.change_summary_text,1,  wx.ALL, 5)

    # GUI Testing done label
    self.testing_done_label = wx.StaticText(self.scroll, -1 , label=u"What tests have you done? :")
    inside_sizer_h6.Add(self.testing_done_label,1,  wx.ALL, 5)

    #FlexGUi Checkbox
    self.gui_check_list = wx.CheckListBox(self.scroll, -1, choices=['GUI Builds Successfully', 'GUI Automation Tests', 'CLI Automation Tests'])
    inside_sizer_h6.Add(self.gui_check_list,1,  wx.ALL, 5)

    # GUI Automation test logs label
    self.gui_auto_log_label = wx.StaticText(self.scroll, -1 , label=u"Enter the logs :")
    inside_sizer_h7.Add(self.gui_auto_log_label,1,  wx.ALL, 5)

    #GUI Automation test box
    self.gui_auto_log = wx.TextCtrl(self.scroll, -1, u'Copy and paste the logs.',style=wx.TE_MULTILINE)
    inside_sizer_h7.Add(self.gui_auto_log,1,  wx.ALL, 5)

    # Review URL Text
    self.review_url_label = wx.StaticText(self.scroll, -1 , label=u"Code review URL :")
    inside_sizer_h8.Add(self.review_url_label,1,  wx.ALL, 5)

    #Code Review Textbox
    self.review_url_tbox =  wx.TextCtrl(self.scroll, -1, value=u"Enter the code review URL",style=wx.TE_MULTILINE)
    inside_sizer_h8.Add(self.review_url_tbox,1,  wx.ALL, 5)

    #Submit button
    self.sub_button = wx.Button(self.scroll, label = 'Submit')
    inside_sizer_h9.Add(self.sub_button, wx.ALL, 5)

    #Cancel button
    self.canc_button = wx.Button(self.scroll, label = 'Cancel')
    inside_sizer_h9.Add(self.canc_button,1,  wx.ALL, 5)


    vbox.Add(inside_sizer_h1, 0 , wx.TOP|wx.EXPAND, 40 )
    vbox.Add(inside_sizer_h2, 0 , wx.ALL|wx.EXPAND, 5 )
    vbox.Add(inside_sizer_h3, 0 , wx.ALL|wx.EXPAND, 5 )
    vbox.Add(inside_sizer_h4, 0 , wx.ALL|wx.EXPAND, 10)
    vbox.Add(inside_sizer_h5, 0 , wx.ALL|wx.EXPAND, 10)
    vbox.Add(inside_sizer_h6, 0 , wx.ALL|wx.EXPAND, 10)
    vbox.Add(inside_sizer_h7, 0 , wx.ALL|wx.EXPAND, 10)
    vbox.Add(inside_sizer_h8, 0 , wx.ALL|wx.EXPAND, 10)
    vbox.Add(inside_sizer_h9, 0 , wx.ALL|wx.EXPAND, 10)

    self.Maximize()
    self.scroll.Size = self.GetSize()
    print self.GetSize()
    self.scroll.SetScrollbars(20,25,45,50)
    self.SetSizer( vbox )
    self.SetSizerAndFit(vbox)
    self.Layout()

    self.notebook.AddPage( self.scroll, u"Delivery", True )

    sizer.Add( self.notebook, 1, wx.EXPAND |wx.ALIGN_RIGHT|wx.ALL, 0 )

    self.SetSizer( sizer )
    self.Layout()

    self.Centre( wx.BOTH )
    self.Show()

if name == "main": app = wx.App() Frame(None) app.MainLoop()

2
Welcome to SO. Try to reduce the code in your question to what is minimally necessary to reproduce the problem. Also, be sure that it is formatted cleanly. Right now you have a very "leaky" code block. - J0e3gan
Did you get this working? - Rolf of Saxony

2 Answers

0
votes

Your code (amended) working on Linux:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import wx
import wx.lib.filebrowsebutton as filebrowse
class Frame ( wx.Frame ):
    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Test", pos = wx.DefaultPosition, size = wx.Size( 600,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
        sizer = wx.BoxSizer( wx.VERTICAL )

        self.notebook = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
        self.login = wx.Panel( self.notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.notebook.AddPage( self.login, u"Login", False )
        self.scroll = wx.ScrolledWindow( self.notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.VSCROLL )
        vbox = wx.BoxSizer(wx.VERTICAL)

        # Sizer for widgets inside tabs
        inside_sizer_h1 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h2 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h3 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h4 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h5 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h6 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h7 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h8 = wx.BoxSizer(wx.HORIZONTAL)
        inside_sizer_h9 = wx.BoxSizer(wx.HORIZONTAL)

        #Test Approve Label
        self.test_app_label = wx.StaticText(self.scroll, -1 , label="Test Approved By :")
        inside_sizer_h1.Add(self.test_app_label, 1,  wx.ALL,5)

        #Test Approve Combo   
        self.tes_app_combo = wx.ComboBox(self.scroll, -1, value='None', choices= ['None', 'approver1', 'approver2', 'approver3', 'approver4'] )
        inside_sizer_h1.Add(self.tes_app_combo, 1, wx.ALL, 5 )


        #Workspace Label
        self.wrksp_label =  wx.StaticText(self.scroll, -1 , label="Workspace :")
        inside_sizer_h2.Add(self.wrksp_label, 1,  wx.ALL,5)

        #Workspace file selector
        self.select_wrksp_dir = filebrowse.DirBrowseButton(self.scroll, -1,labelText = "", toolTip = 'Select tip of your workspace')
        inside_sizer_h2.Add(self.select_wrksp_dir,  1, wx.ALL|wx.EXPAND, 5 )

        # Issuelist label
        self.ar_list_label = wx.StaticText(self.scroll, -1 , label="Issue List :")
        inside_sizer_h3.Add(self.ar_list_label, 1,  wx.ALL,5)

        # Issue Text box
        self.ar_list_text =  wx.TextCtrl(self.scroll, -1, value=u"Enter The issue, one per line", style=wx.TE_MULTILINE)
        inside_sizer_h3.Add(self.ar_list_text,  1, wx.ALL, 5 )

        # Summary of change Title
        self.change_summary_label = wx.StaticText(self.scroll, -1 , label=u"Summary of change :")
        inside_sizer_h4.Add(self.change_summary_label, 1,  wx.ALL, 5)

        # Summary of change Text Box
        self.change_summary_text =  wx.TextCtrl(self.scroll, -1, value=u"What componet has changed?",style=wx.TE_MULTILINE)
        inside_sizer_h4.Add(self.change_summary_text,  1, wx.ALL, 5 )

        # Changed File List Title
        self.change_file_list_label = wx.StaticText(self.scroll, -1 , label=u"Changed File List :")
        inside_sizer_h5.Add(self.change_file_list_label,1,  wx.ALL, 5)

        # Changed File List Box
        self.change_summary_text =  wx.TextCtrl(self.scroll, -1, u' enter list of changed files',style=wx.TE_MULTILINE)
        inside_sizer_h5.Add(self.change_summary_text,1,  wx.ALL, 5)

        # GUI Testing done label
        self.testing_done_label = wx.StaticText(self.scroll, -1 , label=u"What tests have you done? :")
        inside_sizer_h6.Add(self.testing_done_label,1,  wx.ALL, 5)

        #FlexGUi Checkbox
        self.gui_check_list = wx.CheckListBox(self.scroll, -1, choices=['GUI Builds Successfully', 'GUI Automation Tests', 'CLI Automation Tests'])
        inside_sizer_h6.Add(self.gui_check_list,1,  wx.ALL, 5)

        # GUI Automation test logs label
        self.gui_auto_log_label = wx.StaticText(self.scroll, -1 , label=u"Enter the logs :")
        inside_sizer_h7.Add(self.gui_auto_log_label,1,  wx.ALL, 5)

        #GUI Automation test box
        self.gui_auto_log = wx.TextCtrl(self.scroll, -1, u'Copy and paste the logs.',style=wx.TE_MULTILINE)
        inside_sizer_h7.Add(self.gui_auto_log,1,  wx.ALL, 5)

        # Review URL Text
        self.review_url_label = wx.StaticText(self.scroll, -1 , label=u"Code review URL :")
        inside_sizer_h8.Add(self.review_url_label,1,  wx.ALL, 5)

        #Code Review Textbox
        self.review_url_tbox =  wx.TextCtrl(self.scroll, -1, value=u"Enter the code review URL",style=wx.TE_MULTILINE)
        inside_sizer_h8.Add(self.review_url_tbox,1,  wx.ALL, 5)

        #Submit button
        self.sub_button = wx.Button(self.scroll, label = 'Submit')
        inside_sizer_h9.Add(self.sub_button,1, wx.ALL, 5)

        #Cancel button
        self.canc_button = wx.Button(self.scroll, label = 'Cancel')
        inside_sizer_h9.Add(self.canc_button,1,  wx.ALL, 5)


        vbox.Add(inside_sizer_h1, 0 , wx.TOP|wx.EXPAND, 40 )
        vbox.Add(inside_sizer_h2, 0 , wx.ALL|wx.EXPAND, 5 )
        vbox.Add(inside_sizer_h3, 0 , wx.ALL|wx.EXPAND, 5 )
        vbox.Add(inside_sizer_h4, 0 , wx.ALL|wx.EXPAND, 10)
        vbox.Add(inside_sizer_h5, 0 , wx.ALL|wx.EXPAND, 10)
        vbox.Add(inside_sizer_h6, 0 , wx.ALL|wx.EXPAND, 10)
        vbox.Add(inside_sizer_h7, 0 , wx.ALL|wx.EXPAND, 10)
        vbox.Add(inside_sizer_h8, 0 , wx.ALL|wx.EXPAND, 10)
        vbox.Add(inside_sizer_h9, 0 , wx.ALL|wx.EXPAND, 10)

        self.Maximize()
        self.scroll.Size = self.GetSize()
        print self.GetSize()
        self.scroll.SetScrollbars(20,25,45,50)
        self.SetSizer( vbox )
        self.SetSizerAndFit(vbox)
        self.Layout()

        self.notebook.AddPage( self.scroll, u"Delivery", True )

        sizer.Add( self.notebook, 1, wx.EXPAND |wx.ALIGN_RIGHT|wx.ALL, 0 )

        self.SetSizer( sizer )
        self.Layout()

        self.Centre( wx.BOTH )
        self.Show()

if __name__ == "__main__":
    app = wx.App()
    Frame(None)
    app.MainLoop()
0
votes

When adding your items to the sizer, you consistently set the proportion value to 1, with the exception of self.sub_button. It is that which is causing your problem.

inside_sizer_h9.Add(self.sub_button, wx.ALL, 5)    

should read:

inside_sizer_h9.Add(self.sub_button,1, wx.ALL, 5)

Note also that the posted code main is incorrect and should read:

if __name__ == "__main__":   

With those amendments you code should work as you wrote it.