0

In the below python code, scrollbar for the panel is not working. I have added checkboxes under panel in the 2D for loop. Please help here

def GenerateTree(self,event):

    v1=int(val1)
    v2=int(val2)
    print v1,v2
    x=v1+v2
    print x
    panel = wx.lib.scrolledpanel.ScrolledPanel(self,-1, size=(1100,1500),  style=wx.RAISED_BORDER,pos=(10,145))
    panel.SetupScrolling()
    UEarr=('UE1','UE2','UE3','UE4','UE5','UE6','UE7','UE8','UE9','UE10','UE11','UE12')
    LCarr=('LC3','LC4','LC5','LC6','LC7','LC8','LC9','LC10')
    y=0
    i=0
    j=0
    k=0
    for i in range(v1):
        cb = wx.CheckBox(panel, label=str(UEarr[i]), pos=(0, 10+y),style=wx.LC_VRULES)
        cb.SetValue(False)
        for j in range(v2):
            cb1 = wx.CheckBox(panel, label=str(LCarr[j]), pos=(50,20+y))
            cb1.SetValue(False)
            self.tc2 = wx.TextCtrl(panel,-1,pos=(240,20+y),size=(60,20))
            self.tc3 = wx.TextCtrl(panel,-1,pos=(370,20+y),size=(60,20))
            self.tc4 = wx.TextCtrl(panel,-1,pos=(470,20+y),size=(40,20))
            self.tc5 = wx.TextCtrl(panel,-1,pos=(540,20+y),size=(40,20))
            self.tc6 = wx.TextCtrl(panel,-1,pos=(690,20+y),size=(60,20))
            self.tc7 = wx.TextCtrl(panel,-1,pos=(820,20+y),size=(60,20))
            self.tc8 = wx.TextCtrl(panel,-1,pos=(920,20+y),size=(40,20))
            self.tc9 = wx.TextCtrl(panel,-1,pos=(990,20+y),size=(40,20))
            y=y+24
            j=j+1
    i=i+1
2
Contributors
1
Reply
11
Views
1 Year
Discussion Span
Last Post by vegaseat
0
# templet of wxPython's
# wx.lib.scrolledpanel.ScrolledPanel(parent, id, pos, size, style)
# default pos is (0, 0) and default size is (-1, -1) which fills the frame
# the scrolled panel is an area on which other controls are placed
# that can take more space then the parent frame has

import wx
import  wx.lib.scrolledpanel

class MyScrolledPanel(wx.lib.scrolledpanel.ScrolledPanel):
    def __init__(self, parent):
        # make the scrolled panel larger than its parent
        wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, wx.ID_ANY,
            size=(600, 600), style=wx.TAB_TRAVERSAL)
        # scroll bars won't appear until required
        # default is SetupScrolling(scroll_x=True, scroll_y=True)
        self.SetupScrolling()
        self.SetBackgroundColour("white")

        # for testing only
        sp1 = wx.lib.scrolledpanel.ScrolledPanel(self, wx.ID_ANY,
            size=(60, 500), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
        sp1.SetupScrolling(scroll_x=False)
        sp1.SetBackgroundColour("green")

        # this forces the scroll bars to show
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(sp1, 0, wx.ALL, 15)
        self.SetSizer(vbox)

        # create an input widget
        #
        # bind mouse or key event to an action
        #
        # create an output widget
        #

    def onAction(self, event):
        """ some action code"""

        pass


app = wx.App(0)
# create a frame, no parent, default ID, title, size
caption = "wx.lib.scrolledpanel.ScrolledPanel()"
frame = wx.Frame(None, wx.ID_ANY, caption, size=(400, 310))
MyScrolledPanel(frame)
frame.Show(True)
app.MainLoop()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.