Коментарий для объяснения логики работы добавления страниц в noteboock
This commit is contained in:
@@ -6,9 +6,6 @@ class SecondPagePanel(wx.Panel):
|
|||||||
style=wx.FULLSCREEN_NOBORDER)
|
style=wx.FULLSCREEN_NOBORDER)
|
||||||
self.frame = parent
|
self.frame = parent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fgSizer3 = wx.FlexGridSizer(0, 1, 0, 0)
|
fgSizer3 = wx.FlexGridSizer(0, 1, 0, 0)
|
||||||
fgSizer3.SetFlexibleDirection(wx.BOTH)
|
fgSizer3.SetFlexibleDirection(wx.BOTH)
|
||||||
fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
||||||
@@ -36,7 +33,7 @@ class SecondPagePanel(wx.Panel):
|
|||||||
|
|
||||||
# Connect Events
|
# Connect Events
|
||||||
self.m_radioBtn9.Bind(wx.EVT_LEFT_DCLICK, self.lab1)
|
self.m_radioBtn9.Bind(wx.EVT_LEFT_DCLICK, self.lab1)
|
||||||
self.m_radioBtn10.Bind(wx.EVT_LEFT_DCLICK, self.lab1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +42,7 @@ class SecondPagePanel(wx.Panel):
|
|||||||
from labs.lab1 import lab1
|
from labs.lab1 import lab1
|
||||||
nex_page = lab1.MainFrame()
|
nex_page = lab1.MainFrame()
|
||||||
nex_page.Show()
|
nex_page.Show()
|
||||||
|
|
||||||
class SecondPage(wx.Frame):
|
class SecondPage(wx.Frame):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
class PageOne(wx.Panel):
|
class PageOne(wx.Panel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent)
|
wx.Panel.__init__(self, parent)
|
||||||
|
|||||||
54
lab1/lab1.py
54
lab1/lab1.py
@@ -1,54 +0,0 @@
|
|||||||
import wx
|
|
||||||
from docx import Document
|
|
||||||
|
|
||||||
class Ttheory(wx.Panel):
|
|
||||||
def __init__(self, parent):
|
|
||||||
wx.Panel.__init__(self, parent)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_theor(self):
|
|
||||||
doc = Document('test1.docx')
|
|
||||||
text_doc = doc.paragrapghs()
|
|
||||||
self.doc_text.SetLabel(text_doc)
|
|
||||||
|
|
||||||
|
|
||||||
class Labs(wx.Panel):
|
|
||||||
def __init__(self, parent):
|
|
||||||
wx.Panel.__init__(self, parent)
|
|
||||||
|
|
||||||
class Results(wx.Panel):
|
|
||||||
def __init__(self, parent):
|
|
||||||
wx.Panel.__init__(self, parent)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainFrame(wx.Frame):
|
|
||||||
def __init__(self):
|
|
||||||
wx.Frame.__init__(self, None, title="Simple Notebook Example")
|
|
||||||
|
|
||||||
# Here we create a panel and a notebook on the panel
|
|
||||||
p = wx.Panel(self)
|
|
||||||
nb = wx.Notebook(p)
|
|
||||||
|
|
||||||
# create the page windows as children of the notebook
|
|
||||||
page1 = Ttheory(nb)
|
|
||||||
page2 = Labs(nb)
|
|
||||||
page3 = Results(nb)
|
|
||||||
|
|
||||||
# add the pages to the notebook with the label to show on the tab
|
|
||||||
nb.AddPage(page1, "Теория")
|
|
||||||
nb.AddPage(page2, "Задание")
|
|
||||||
nb.AddPage(page3, "Отчёт")
|
|
||||||
|
|
||||||
# finally, put the notebook in a sizer for the panel to manage
|
|
||||||
# the layout
|
|
||||||
sizer = wx.BoxSizer()
|
|
||||||
sizer.Add(nb, 1, wx.EXPAND)
|
|
||||||
p.SetSizer(sizer)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app = wx.App()
|
|
||||||
MainFrame().Show()
|
|
||||||
app.MainLoop()
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import wx
|
|
||||||
|
|
||||||
def scale_bitmap(bitmap, width, height):
|
|
||||||
image = wx.ImageFromBitmap(bitmap)
|
|
||||||
image = image.Scale(width, height, wx.IMAGE_QUALITY_HIGH)
|
|
||||||
result = wx.BitmapFromImage(image)
|
|
||||||
return result
|
|
||||||
|
|
||||||
class Panel(wx.Panel):
|
|
||||||
def __init__(self, parent, path):
|
|
||||||
super(Panel, self).__init__(parent, -1)
|
|
||||||
bitmap = wx.Bitmap(path)
|
|
||||||
bitmap = scale_bitmap(bitmap, 300, 200)
|
|
||||||
control = wx.StaticBitmap(self, -1, bitmap)
|
|
||||||
control.SetPosition((10, 10))
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app = wx.PySimpleApp()
|
|
||||||
frame = wx.Frame(None, -1, 'Scaled Image')
|
|
||||||
panel = Panel(frame, 'input.jpg')
|
|
||||||
frame.Show()
|
|
||||||
app.MainLoop()
|
|
||||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
|||||||
from docx import Document
|
|
||||||
|
|
||||||
doc = Document('test.docx')
|
|
||||||
full_text = []
|
|
||||||
for i in doc.paragraphs:
|
|
||||||
full_text.append(i.text)
|
|
||||||
|
|
||||||
print(full_text)
|
|
||||||
Reference in New Issue
Block a user