Вторая страница автоматически в поноэкранном размере
Добавлена возможность подстроения изобнражения, пока не реализовано
This commit is contained in:
83
gui/page2.py
Normal file
83
gui/page2.py
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import wx
|
||||||
|
|
||||||
|
|
||||||
|
class MyFrame4(wx.Frame):
|
||||||
|
def __init__(self, parent):
|
||||||
|
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
|
||||||
|
size=wx.Size(500, 500), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
|
||||||
|
|
||||||
|
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
||||||
|
|
||||||
|
self.Centre(wx.BOTH)
|
||||||
|
self.Maximize(True)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MyPanel5(wx.Panel):
|
||||||
|
def __init__(self, parent):
|
||||||
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 500),
|
||||||
|
style=wx.FULLSCREEN_NOBORDER)
|
||||||
|
self.Bind(wx.EVT_PAINT, self.onPaint)
|
||||||
|
|
||||||
|
bSizer2 = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
self.imgMaxSize = 200
|
||||||
|
|
||||||
|
self.lbl_zag_page2 = wx.StaticText(self, wx.ID_ANY, u"Схема перекрёстка и транаспортных потоков на нём",
|
||||||
|
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||||
|
self.lbl_zag_page2.Wrap(-1)
|
||||||
|
bSizer2.Add(self.lbl_zag_page2, 0, wx.ALIGN_CENTER | wx.ALL, 5)
|
||||||
|
|
||||||
|
fgSizer2 = wx.FlexGridSizer(3, 2, 0, 0)
|
||||||
|
fgSizer2.SetFlexibleDirection(wx.BOTH)
|
||||||
|
fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
||||||
|
|
||||||
|
self.lbl_shema = wx.StaticText(self, wx.ID_ANY, u" Схема перекрёстка", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||||
|
self.lbl_shema.Wrap(-1)
|
||||||
|
fgSizer2.Add(self.lbl_shema, 0, wx.ALL, 5)
|
||||||
|
|
||||||
|
self.lbl_trpotok = wx.StaticText(self, wx.ID_ANY, u"Картограмма транаспортных потоков", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||||
|
self.lbl_trpotok.Wrap(-1)
|
||||||
|
fgSizer2.Add(self.lbl_trpotok, 0, wx.ALL, 5)
|
||||||
|
|
||||||
|
self.shema_perekr = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(u"src/shema_01.jpg", wx.BITMAP_TYPE_ANY))
|
||||||
|
|
||||||
|
fgSizer2.Add(self.shema_perekr, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
|
||||||
|
|
||||||
|
self.kartogramma = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(u"src/kartogramma_perekrestka.gif", wx.BITMAP_TYPE_ANY))
|
||||||
|
|
||||||
|
fgSizer2.Add(self.kartogramma, 1, wx.ALIGN_RIGHT | wx.EXPAND, 5)
|
||||||
|
|
||||||
|
bSizer2.Add(fgSizer2, 1, wx.EXPAND, 5)
|
||||||
|
|
||||||
|
self.btn_page3 = wx.Button(self, wx.ID_ANY, u"Далее", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||||
|
bSizer2.Add(self.btn_page3, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
|
||||||
|
|
||||||
|
self.SetSizer(bSizer2)
|
||||||
|
self.Layout()
|
||||||
|
|
||||||
|
# Connect Events
|
||||||
|
self.btn_page3.Bind(wx.EVT_BUTTON, self.go_page3)
|
||||||
|
|
||||||
|
def onPaint(self, event):
|
||||||
|
dc = wx.PaintDC(self)
|
||||||
|
dc.Clear()
|
||||||
|
x, y = self.GetSize()
|
||||||
|
newx =200
|
||||||
|
newy=200
|
||||||
|
x = newx
|
||||||
|
y = newy
|
||||||
|
#shema_perekr = self.shema_perekr.Scale()
|
||||||
|
|
||||||
|
# Virtual event handlers, overide them in your derived class
|
||||||
|
def go_page3(self, event):
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def run_page(self):
|
||||||
|
app = wx.App()
|
||||||
|
frame = MyFrame4(None)
|
||||||
|
panel = MyPanel5(frame)
|
||||||
|
frame.Show()
|
||||||
|
app.MainLoop()
|
||||||
@@ -1271,7 +1271,7 @@
|
|||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
<event name="OnButtonClick"></event>
|
<event name="OnButtonClick">go_page2</event>
|
||||||
<event name="OnChar"></event>
|
<event name="OnChar"></event>
|
||||||
<event name="OnEnterWindow"></event>
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground"></event>
|
<event name="OnEraseBackground"></event>
|
||||||
|
|||||||
22
learn/image2.py
Normal file
22
learn/image2.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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()
|
||||||
51
main.py
51
main.py
@@ -1,20 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
## Python code generated with wxFormBuilder (version Jan 25 2018)
|
|
||||||
## http://www.wxformbuilder.org/
|
|
||||||
##
|
|
||||||
## PLEASE DO *NOT* EDIT THIS FILE!
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.xrc
|
import wx.xrc
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
## Class MainFrame
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
class MainFrame(wx.Frame):
|
class MainFrame(wx.Frame):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
|
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
|
||||||
@@ -28,14 +17,13 @@ class MainFrame(wx.Frame):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
############################################################################# Class MainFramePanel
|
||||||
## Class MainFramePanel
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
class MainFramePanel(wx.Panel):
|
class MainFramePanel(wx.Panel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 500),
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 500),
|
||||||
style=wx.TAB_TRAVERSAL)
|
style=wx.FULL_REPAINT_ON_RESIZE)
|
||||||
|
|
||||||
bSizer1 = wx.BoxSizer(wx.VERTICAL)
|
bSizer1 = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
|
||||||
@@ -82,8 +70,8 @@ class MainFramePanel(wx.Panel):
|
|||||||
self.lbl_zachetka.Wrap(-1)
|
self.lbl_zachetka.Wrap(-1)
|
||||||
fgSizer1.Add(self.lbl_zachetka, 0, wx.ALL, 5)
|
fgSizer1.Add(self.lbl_zachetka, 0, wx.ALL, 5)
|
||||||
|
|
||||||
self.m_textCtrl5 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
|
self.inpt_zachetka = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||||
fgSizer1.Add(self.m_textCtrl5, 0, wx.ALL, 5)
|
fgSizer1.Add(self.inpt_zachetka, 0, wx.ALL, 5)
|
||||||
|
|
||||||
bSizer1.Add(fgSizer1, 1, wx.EXPAND, 5)
|
bSizer1.Add(fgSizer1, 1, wx.EXPAND, 5)
|
||||||
|
|
||||||
@@ -99,11 +87,36 @@ class MainFramePanel(wx.Panel):
|
|||||||
|
|
||||||
self.SetSizer(bSizer1)
|
self.SetSizer(bSizer1)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
self.Show()
|
|
||||||
|
|
||||||
def __del__(self):
|
self.btn_page2.Bind(wx.EVT_BUTTON, self.go_page2)
|
||||||
|
|
||||||
|
def on_init(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def go_page2(self,event):
|
||||||
|
text = []
|
||||||
|
login = " "
|
||||||
|
name = self.inpt_name.GetValue()
|
||||||
|
text.append(name)
|
||||||
|
login = ''.join(str(name))
|
||||||
|
familia = self.inpt_familia.GetValue()
|
||||||
|
text.append(familia)
|
||||||
|
|
||||||
|
group = self.inpt_group.GetValue()
|
||||||
|
text.append(group)
|
||||||
|
|
||||||
|
zach_numb = str(self.inpt_zachetka.GetValue())
|
||||||
|
|
||||||
|
variant_num = zach_numb[-2:len(zach_numb)]
|
||||||
|
from gui import page2
|
||||||
|
|
||||||
|
page2.MyPanel5.run_page(self)
|
||||||
|
print(login)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app = wx.App()
|
app = wx.App()
|
||||||
frame = MainFrame(None)
|
frame = MainFrame(None)
|
||||||
panel = MainFramePanel(frame)
|
panel = MainFramePanel(frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user