1 Star 0 Fork 2

武斌/SmartEdu_1

forked from Akai_akari/SmartEdu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
result_panel.py 2.06 KB
一键复制 编辑 原始数据 按行查看 历史
import wx
import wx.xrc
import json
class ResultFrame(wx.Frame):
def __init__(self, p, res_image):
wx.Frame.__init__(self, parent=p, id=wx.ID_ANY, title="批改结果", size=wx.Size(800, 800))
self.res_image = res_image
icon_obj = wx.Icon(name="image/tubiao.png", type=wx.BITMAP_TYPE_PNG)
self.SetIcon(icon_obj)
with open("Data.json", 'rb') as f:
params = json.load(f)
first_colour = tuple(params['background_color'])
f.close()
self.SetBackgroundColour(colour=first_colour)
self.m_panel = wx.Panel(self, wx.ID_ANY)
self.m_panel.SetBackgroundColour(colour=first_colour)
box_back = wx.BoxSizer(wx.VERTICAL)
self.m_panel.SetSizer(box_back)
self.m_panel.Layout()
box_back.Fit(self.m_panel)
self.Centre(wx.BOTH)
# 结果显示
self.result = wx.StaticText(self.m_panel, wx.ID_ANY, u"批改结果为:")
self.result.SetFont(wx.Font(35, 70, 90, 90, False, "微软雅黑"))
box_back.Add(self.result, 1, wx.ALIGN_CENTER | wx.ALL, 5)
# 图片
self.pho = wx.StaticBitmap(self.m_panel, wx.ID_ANY, wx.Bitmap(self.res_image, wx.BITMAP_TYPE_ANY))
box_back.Add(self.pho, 5, wx.EXPAND, 1)
# 绑定确定和取消
m_sdbSizer = wx.StdDialogButtonSizer()
self.m_sdbSizerSave = wx.Button(self.m_panel, wx.ID_SAVE, label='保存')
m_sdbSizer.AddButton(self.m_sdbSizerSave)
self.Bind(wx.EVT_BUTTON, self.Save, self.m_sdbSizerSave)
self.m_sdbSizerCancel = wx.Button(self.m_panel, wx.ID_CANCEL, label='取消')
m_sdbSizer.AddButton(self.m_sdbSizerCancel)
m_sdbSizer.Realize()
self.Bind(wx.EVT_BUTTON, self.Cancel, self.m_sdbSizerCancel)
box_back.Add(m_sdbSizer, 1, wx.EXPAND, 5)
def Save(self, event):
self.Destroy()
def Cancel(self, event):
self.Destroy()
def main():
app = wx.App(False)
frame = ResultFrame(None, "image/background.png")
frame.Show(True)
app.MainLoop()
if __name__ == "__main__":
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/guai128/smart-edu_1.git
[email protected]:guai128/smart-edu_1.git
guai128
smart-edu_1
SmartEdu_1
master

搜索帮助