Home > other >  Wxpython scroll bar, the following code will not display the scroll bar (scrolled no effect), is thi
Wxpython scroll bar, the following code will not display the scroll bar (scrolled no effect), is thi

Time:09-19

 import wx 
The import wx. Lib. Scrolledpanel as scrolled

The class TestPanel (scrolled. ScrolledPanel) :

Def __init__ (self, parent) :

Scrolled. ScrolledPanel. __init__ (self, parent, 1)

# Vbox=wx. BoxSizer (wx. VERTICAL)

# desc=wx. StaticText (self, 1, 'text')

# desc. SetForegroundColour (" Blue ")
# Vbox. Add (desc, 0, wx ALIGN_LEFT | wx. ALL, 5)
# Vbox. Add (wx. StaticLine (self - 1, size=(1024, 1)), and 0, wx. ALL, 5)
# Vbox. Add ((20, 20))

# the self. The SetSizer (Vbox)
Self. TB=TestTB (self - 1)
Self. SetupScrolling ()

The class TestTB (wx. Toolbook) :
Def __init__ (self, parent, id) :
Print (id)
Wx. Toolbook. __init__ (self, parent, id, size=(900600), style=wx. BK_DEFAULT) # note: the size must be set up, in the time that I discovered this afternoon with a
Il=wx. ImageList (48, 48) # suggestion with the size of the image consistent
Bmp0=wx. Image (' 1. PNG ', wx. BITMAP_TYPE_PNG). ConvertToBitmap () # Image path for the relative path, can also be set to the absolute path
Bmp1=wx. Image (' 1. PNG ', wx. BITMAP_TYPE_PNG). ConvertToBitmap ()
Bmp2=wx. Image (' 1. PNG ', wx. BITMAP_TYPE_PNG). ConvertToBitmap ()
Bmp3=wx. Image (' 1. PNG ', wx. BITMAP_TYPE_PNG). ConvertToBitmap ()
Bmp4=wx. Image (' 1. PNG ', wx. BITMAP_TYPE_PNG). ConvertToBitmap ()
Index0=il. The Add (bmp0)
Index1=il. The Add (bmp1)
Index2=il. The Add (bmp2)
And index3=il. The Add (bmp3)
Index4=il. The Add (bmp4)
Print (index4)
Print (il) GetImageCount ())
Self. AssignImageList (il)
# p=newPanel (None)
Pag1=PageOne (self)
Pag1. SetBackgroundColour (wx. See Colour (166, 255, 166))
The self. The AddPage (pag1, "System Info", imageId=index0)
Pag2=PageTwo (self)

Self. The AddPage (pag2, Intranet "Found", imageId=index1)
Pag3=PageThree (self)
Pag3. SetBackgroundColour (wx. See Colour (0, 0, 0))
The self. The AddPage (pag3, "PC Resolution", imageId=index2)
Pag4=PageFour (self)
Pag4. SetBackgroundColour (wx. See Colour (0, 0, 0))
The self. The AddPage (pag4, "Network Resolution", imageId=and index3)
Pag5=PageFive (self)
Pag5. SetBackgroundColour (wx. See Colour (0, 0, 0))
The self. The AddPage (pag5, "Port Scan", imageId=index4)

The class PageOne (wx. The Panel) :
Def __init__ (self, parent) :
Wx. Panel. __init__ (self, parent)
The self. The panel=wx. A panel (self)
The self. The button=wx. Button (self. The panel, 1, "hello," pos=(1, 1))
The self. The Bind (wx. EVT_BUTTON, self OnClick, self. The button)
The self. The button. SetDefault ()

The self. The sizer=wx. BoxSizer ()
Self. Sizer. Add (self. The panel, 1, wx. EXPAND)
The self. The SetSizer (self. Sizer)


Def OnClick (self, event) :
The self. The button. SetLabel (" Clicked ")




The class PageTwo (wx. The Panel) :
Def __init__ (self, parent) :
Wx. Panel. __init__ (self, parent, size=(840450))
The self. The panel=wx. A panel (self)



The class PageThree (wx. The Panel) :
Def __init__ (self, parent) :
Wx. Panel. __init__ (self, parent)
The panel=wx. A panel (self)
See colour=[(160255204), (153204255), (151253225),]
Self. SetBackgroundColour (see [0])
The self. The center=wx. StaticText (self, 1, "instructions", (355, 35),
(100-1), wx. ALIGN_CENTER)
The font=wx. The font (14, wx. SWISS, wx. NORMAL, wx. BOLD)
The self. The center. The SetFont (font)

The class PageFour (wx. The Panel) :
Def __init__ (self, parent) :
Wx. Panel. __init__ (self, parent)
The panel=wx. A panel (self)
See colour=[(160255204), (153204255), (151253225),]
Self. SetBackgroundColour (see [0])
The self. The center=wx. StaticText (self, 1, "instructions", (355, 35),
(100-1), wx. ALIGN_CENTER)
The font=wx. The font (14, wx. SWISS, wx. NORMAL, wx. BOLD)
The self. The center. The SetFont (font)

The class PageFive (wx. The Panel) :
Def __init__ (self, parent, id=wx. ID_ANY, pos=wx. DefaultPosition, size=wx. Size (1, 1), style=wx. HSCROLL | wx. VSCROLL, name=wx. EmptyString) :
Wx. Panel. __init__ (self, parent, id=id, pos=pos, size=the size, style=style, name=name)

BSizer22=wx. BoxSizer (wx. VERTICAL)

Self. M_notebook1=wx. Notebook (self, wx. ID_ANY, wx DefaultPosition, wx. DefaultSize, 0)
Self. M_panel23=wx. A Panel (self. M_notebook1, wx. ID_ANY, wx DefaultPosition, wx. DefaultSize, wx. TAB_TRAVERSAL)
BSizer23=wx. BoxSizer (wx. VERTICAL)

Self. M_button16=wx. Button (self. M_panel23, wx ID_ANY, u "MyButton", wx. DefaultPosition, wx. DefaultSize, 0)
BSizer23. Add (self. M_button16, 0, wx. ALL, 5)


Self. M_panel23. SetSizer (bSizer23)
Self. M_panel23. Layout ()
BSizer23. Fit (self. M_panel23)
Self. M_notebook1. The AddPage (self m_panel23, u "a page", False)
Self. M_panel24=wx. A Panel (self. M_notebook1, wx. ID_ANY, wx DefaultPosition, wx. DefaultSize, wx. TAB_TRAVERSAL)
BSizer24=wx. BoxSizer (wx. VERTICAL)

Self. M_button17=wx. Button (self. M_panel24, wx ID_ANY, u "MyButton", wx. DefaultPosition, wx. DefaultSize, 0)
BSizer24. Add (self. M_button17, 0, wx. ALL, 5)


Self. M_panel24. SetSizer (bSizer24)
Self. M_panel24. Layout ()
BSizer24. Fit (self. M_panel24)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull