Wxpython - 删除应用程序中的选项卡
Wxpython - remove tabs in application
我有一个应用程序,我以前一直使用多个选项卡。我已经更改了应用程序,现在只需要一个面板。我的问题是我似乎无法弄清楚如何摆脱多余的选项卡并恢复到单个面板。删除第 12 行和第 13 行中的 self.tabbed
只会导致面板看起来很奇怪,所有内容都被压到角落里。下面是当前的标签代码,我已经删除了很多不相关的代码/类,等等。在不影响太多代码的情况下最有效的方法是什么?
更新 1:
我更新了下面的代码,现在可以运行了。
import wx
import wx.lib.agw.aui as aui
import wx.stc as stc
import os
import platform
import time
systemType = platform.system()
if systemType == "Windows":
import win32wnet
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
run_params = {}
self.run_params = run_params
# OS dependent info
self.run_params["systemType"] = systemType
if systemType == "Windows":
self.run_params["fontSize"] = 8
self.run_params["fontSize2"] = 7
else:
self.run_params["fontSize"] = 10
self.run_params["fontSize2"] = 9
wx.Frame.__init__(self, parent, id, title, size=(900, 710), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER |
wx.RESIZE_BOX |
wx.MAXIMIZE_BOX))
style = aui.AUI_NB_DEFAULT_STYLE ^ aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
self.tabbed = aui.AuiNotebook(self, agwStyle=style)
self.submissions = SubmissionPane(self.tabbed, self, run_params)
self.CreateStatusBar()
self.tabbed.AddPage(self.submissions, "TAB1")
menuBar = wx.MenuBar()
self.Centre()
self.Show()
class SubmissionPane(wx.Panel):
def __init__(self, parent, frame, run_params):
wx.Panel.__init__(self, parent)
self.parent = parent
self.selected_folders = None
self.params = run_params
self.frame = frame
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.top_row_sizer = wx.BoxSizer(wx.HORIZONTAL);
radio_static_box = wx.StaticBox(self, label='Some Text')
radio_static_box_sizer = wx.StaticBoxSizer(radio_static_box, wx.HORIZONTAL)
job_static_box = wx.StaticBox(self, label='Some Text')
job_static_box_sizer = wx.StaticBoxSizer(job_static_box, wx.HORIZONTAL)
'''
radio_labels = ['Some Text', 'Some Text2']
self.radio_box = wx.RadioBox(
self, -1, "",
choices=radio_labels,
)
'''
self.radio1 = wx.RadioButton(self, label='Some Text', style=wx.RB_GROUP)
self.radio2 = wx.RadioButton(self, label='Some Text')
self.radio1.SetValue(True)
radio_static_box_sizer.Add(self.radio1, flag=wx.BOTTOM, border=0)
radio_static_box_sizer.Add(self.radio2, flag=wx.LEFT, border=10)
self.top_row_sizer.Add(radio_static_box_sizer, flag=wx.LEFT, border=10)
self.check_box = wx.CheckBox(self, label="Some Text")
self.check_box.SetValue(False)
if self.params["systemType"] == "Windows":
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(306, 14))
else:
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(350, 19))
job_static_box_sizer.Add(self.check_box, flag=wx.LEFT, border=0)
self.top_row_sizer.Add(job_static_box_sizer, flag=wx.LEFT, border=10);
self.txtTitle.Show(False)
main_sizer.Add(self.top_row_sizer);
main_sizer.Add((-1, 10))
job_static_box2 = wx.StaticBox(self, label='Some Text')
third_row_sizer = wx.StaticBoxSizer(job_static_box2, wx.HORIZONTAL);
self.tc_files = wx.TextCtrl(self, size=(375, 25))
self.buttonGo = wx.Button(self, label='Go')
self.buttonGo.Bind(wx.EVT_BUTTON, self.OnSubmit)
third_row_sizer.Add(self.tc_files, flag=wx.RIGHT, border=8)
if self.params["systemType"] == "Windows":
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=0)
else:
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=2)
main_sizer.Add(third_row_sizer, flag=wx.LEFT, border=10)
self.log_text22 = wx.ListCtrl(self,size=(875,275),
style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.LC_HRULES)
font = wx.Font(self.params["fontSize2"], wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.log_text22.SetFont(font)
self.log_text22.InsertColumn(1, '1', width=40, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(2, '2', width=50, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(3, '3', width=156)
self.log_text22.InsertColumn(4, '4', width=332)
self.log_text22.InsertColumn(5, '5', width=100, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(6, '6', width=82, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(7, '7', width=60, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(8, '8', width=50, format=wx.LIST_FORMAT_CENTRE)
main_sizer.Add((-1, 10))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.log_text22, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
self.running_log1 = wx.stc.StyledTextCtrl(self, -1, size=(875,175))
self.running_log1.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, font)
self.running_log1.SetMarginWidth(1, 0)
self.running_log1.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, (0,0,0))
self.running_log1.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, (0,255,0))
self.running_log1.StyleClearAll()
main_sizer.Add((-1, 5))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.running_log1, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
list_sizer.Add((-1, 10))
self.buttonClose = wx.Button(self, -1, "Quit")
list_sizer.Add(self.buttonClose, flag=wx.ALIGN_CENTER | wx.TOP | wx.LEFT, border=10)
self.SetBackgroundColour("Light Grey")
self.SetSizer(main_sizer)
self.Show()
def OnSubmit(self, event):
msg = "Running"
jobSubmitmsg = wx.BusyInfo(msg, self)
time.sleep(3)
jobSubmitmsg = None
app = wx.App(redirect=False)
MainWindow(None, -1, 'Application')
app.MainLoop()
更新 2:
下面的答案很有效。
干杯。
如果您根本不需要笔记本,那么您可以只使用 SubmissionPane 本身并删除 aui 东西:
import wx
import wx.stc as stc
import os
import platform
import time
systemType = platform.system()
if systemType == "Windows":
import win32wnet
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
run_params = {}
self.run_params = run_params
# OS dependent info
self.run_params["systemType"] = systemType
if systemType == "Windows":
self.run_params["fontSize"] = 8
self.run_params["fontSize2"] = 7
else:
self.run_params["fontSize"] = 10
self.run_params["fontSize2"] = 9
wx.Frame.__init__(self, parent, id, title, size=(900, 710), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER |
wx.RESIZE_BOX |
wx.MAXIMIZE_BOX))
##########################################################
# Passed self here and removed the unnecessary second self
##########################################################
self.submissions = SubmissionPane(self, run_params)
self.CreateStatusBar()
menuBar = wx.MenuBar()
self.Centre()
self.Show()
class SubmissionPane(wx.Panel):
################################################
# changed the init here
################################################
def __init__(self, parent, run_params):
wx.Panel.__init__(self, parent)
self.parent = parent
self.selected_folders = None
self.params = run_params
################################################
# changed the ref below
################################################
self.frame = self
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.top_row_sizer = wx.BoxSizer(wx.HORIZONTAL);
radio_static_box = wx.StaticBox(self, label='Some Text')
radio_static_box_sizer = wx.StaticBoxSizer(radio_static_box, wx.HORIZONTAL)
job_static_box = wx.StaticBox(self, label='Some Text')
job_static_box_sizer = wx.StaticBoxSizer(job_static_box, wx.HORIZONTAL)
'''
radio_labels = ['Some Text', 'Some Text2']
self.radio_box = wx.RadioBox(
self, -1, "",
choices=radio_labels,
)
'''
self.radio1 = wx.RadioButton(self, label='Some Text', style=wx.RB_GROUP)
self.radio2 = wx.RadioButton(self, label='Some Text')
self.radio1.SetValue(True)
radio_static_box_sizer.Add(self.radio1, flag=wx.BOTTOM, border=0)
radio_static_box_sizer.Add(self.radio2, flag=wx.LEFT, border=10)
self.top_row_sizer.Add(radio_static_box_sizer, flag=wx.LEFT, border=10)
self.check_box = wx.CheckBox(self, label="Some Text")
self.check_box.SetValue(False)
if self.params["systemType"] == "Windows":
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(306, 14))
else:
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(350, 19))
job_static_box_sizer.Add(self.check_box, flag=wx.LEFT, border=0)
self.top_row_sizer.Add(job_static_box_sizer, flag=wx.LEFT, border=10);
self.txtTitle.Show(False)
main_sizer.Add(self.top_row_sizer);
main_sizer.Add((-1, 10))
job_static_box2 = wx.StaticBox(self, label='Some Text')
third_row_sizer = wx.StaticBoxSizer(job_static_box2, wx.HORIZONTAL);
self.tc_files = wx.TextCtrl(self, size=(375, 25))
self.buttonGo = wx.Button(self, label='Go')
self.buttonGo.Bind(wx.EVT_BUTTON, self.OnSubmit)
third_row_sizer.Add(self.tc_files, flag=wx.RIGHT, border=8)
if self.params["systemType"] == "Windows":
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=0)
else:
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=2)
main_sizer.Add(third_row_sizer, flag=wx.LEFT, border=10)
self.log_text22 = wx.ListCtrl(self,size=(875,275),
style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.LC_HRULES)
font = wx.Font(self.params["fontSize2"], wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.log_text22.SetFont(font)
self.log_text22.InsertColumn(1, '1', width=40, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(2, '2', width=50, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(3, '3', width=156)
self.log_text22.InsertColumn(4, '4', width=332)
self.log_text22.InsertColumn(5, '5', width=100, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(6, '6', width=82, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(7, '7', width=60, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(8, '8', width=50, format=wx.LIST_FORMAT_CENTRE)
main_sizer.Add((-1, 10))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.log_text22, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
self.running_log1 = wx.stc.StyledTextCtrl(self, -1, size=(875,175))
self.running_log1.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, font)
self.running_log1.SetMarginWidth(1, 0)
self.running_log1.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, (0,0,0))
self.running_log1.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, (0,255,0))
self.running_log1.StyleClearAll()
main_sizer.Add((-1, 5))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.running_log1, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
list_sizer.Add((-1, 10))
self.buttonClose = wx.Button(self, -1, "Quit")
list_sizer.Add(self.buttonClose, flag=wx.ALIGN_CENTER | wx.TOP | wx.LEFT, border=10)
self.SetBackgroundColour("Light Grey")
self.SetSizer(main_sizer)
self.Layout()
def OnSubmit(self, event):
msg = "Running"
jobSubmitmsg = wx.BusyInfo(msg, self)
time.sleep(3)
jobSubmitmsg = None
app = wx.App(redirect=False)
MainWindow(None, -1, 'Application')
app.MainLoop()
我有一个应用程序,我以前一直使用多个选项卡。我已经更改了应用程序,现在只需要一个面板。我的问题是我似乎无法弄清楚如何摆脱多余的选项卡并恢复到单个面板。删除第 12 行和第 13 行中的 self.tabbed
只会导致面板看起来很奇怪,所有内容都被压到角落里。下面是当前的标签代码,我已经删除了很多不相关的代码/类,等等。在不影响太多代码的情况下最有效的方法是什么?
更新 1:
我更新了下面的代码,现在可以运行了。
import wx
import wx.lib.agw.aui as aui
import wx.stc as stc
import os
import platform
import time
systemType = platform.system()
if systemType == "Windows":
import win32wnet
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
run_params = {}
self.run_params = run_params
# OS dependent info
self.run_params["systemType"] = systemType
if systemType == "Windows":
self.run_params["fontSize"] = 8
self.run_params["fontSize2"] = 7
else:
self.run_params["fontSize"] = 10
self.run_params["fontSize2"] = 9
wx.Frame.__init__(self, parent, id, title, size=(900, 710), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER |
wx.RESIZE_BOX |
wx.MAXIMIZE_BOX))
style = aui.AUI_NB_DEFAULT_STYLE ^ aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
self.tabbed = aui.AuiNotebook(self, agwStyle=style)
self.submissions = SubmissionPane(self.tabbed, self, run_params)
self.CreateStatusBar()
self.tabbed.AddPage(self.submissions, "TAB1")
menuBar = wx.MenuBar()
self.Centre()
self.Show()
class SubmissionPane(wx.Panel):
def __init__(self, parent, frame, run_params):
wx.Panel.__init__(self, parent)
self.parent = parent
self.selected_folders = None
self.params = run_params
self.frame = frame
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.top_row_sizer = wx.BoxSizer(wx.HORIZONTAL);
radio_static_box = wx.StaticBox(self, label='Some Text')
radio_static_box_sizer = wx.StaticBoxSizer(radio_static_box, wx.HORIZONTAL)
job_static_box = wx.StaticBox(self, label='Some Text')
job_static_box_sizer = wx.StaticBoxSizer(job_static_box, wx.HORIZONTAL)
'''
radio_labels = ['Some Text', 'Some Text2']
self.radio_box = wx.RadioBox(
self, -1, "",
choices=radio_labels,
)
'''
self.radio1 = wx.RadioButton(self, label='Some Text', style=wx.RB_GROUP)
self.radio2 = wx.RadioButton(self, label='Some Text')
self.radio1.SetValue(True)
radio_static_box_sizer.Add(self.radio1, flag=wx.BOTTOM, border=0)
radio_static_box_sizer.Add(self.radio2, flag=wx.LEFT, border=10)
self.top_row_sizer.Add(radio_static_box_sizer, flag=wx.LEFT, border=10)
self.check_box = wx.CheckBox(self, label="Some Text")
self.check_box.SetValue(False)
if self.params["systemType"] == "Windows":
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(306, 14))
else:
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(350, 19))
job_static_box_sizer.Add(self.check_box, flag=wx.LEFT, border=0)
self.top_row_sizer.Add(job_static_box_sizer, flag=wx.LEFT, border=10);
self.txtTitle.Show(False)
main_sizer.Add(self.top_row_sizer);
main_sizer.Add((-1, 10))
job_static_box2 = wx.StaticBox(self, label='Some Text')
third_row_sizer = wx.StaticBoxSizer(job_static_box2, wx.HORIZONTAL);
self.tc_files = wx.TextCtrl(self, size=(375, 25))
self.buttonGo = wx.Button(self, label='Go')
self.buttonGo.Bind(wx.EVT_BUTTON, self.OnSubmit)
third_row_sizer.Add(self.tc_files, flag=wx.RIGHT, border=8)
if self.params["systemType"] == "Windows":
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=0)
else:
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=2)
main_sizer.Add(third_row_sizer, flag=wx.LEFT, border=10)
self.log_text22 = wx.ListCtrl(self,size=(875,275),
style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.LC_HRULES)
font = wx.Font(self.params["fontSize2"], wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.log_text22.SetFont(font)
self.log_text22.InsertColumn(1, '1', width=40, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(2, '2', width=50, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(3, '3', width=156)
self.log_text22.InsertColumn(4, '4', width=332)
self.log_text22.InsertColumn(5, '5', width=100, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(6, '6', width=82, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(7, '7', width=60, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(8, '8', width=50, format=wx.LIST_FORMAT_CENTRE)
main_sizer.Add((-1, 10))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.log_text22, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
self.running_log1 = wx.stc.StyledTextCtrl(self, -1, size=(875,175))
self.running_log1.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, font)
self.running_log1.SetMarginWidth(1, 0)
self.running_log1.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, (0,0,0))
self.running_log1.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, (0,255,0))
self.running_log1.StyleClearAll()
main_sizer.Add((-1, 5))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.running_log1, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
list_sizer.Add((-1, 10))
self.buttonClose = wx.Button(self, -1, "Quit")
list_sizer.Add(self.buttonClose, flag=wx.ALIGN_CENTER | wx.TOP | wx.LEFT, border=10)
self.SetBackgroundColour("Light Grey")
self.SetSizer(main_sizer)
self.Show()
def OnSubmit(self, event):
msg = "Running"
jobSubmitmsg = wx.BusyInfo(msg, self)
time.sleep(3)
jobSubmitmsg = None
app = wx.App(redirect=False)
MainWindow(None, -1, 'Application')
app.MainLoop()
更新 2:
下面的答案很有效。 干杯。
如果您根本不需要笔记本,那么您可以只使用 SubmissionPane 本身并删除 aui 东西:
import wx
import wx.stc as stc
import os
import platform
import time
systemType = platform.system()
if systemType == "Windows":
import win32wnet
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
run_params = {}
self.run_params = run_params
# OS dependent info
self.run_params["systemType"] = systemType
if systemType == "Windows":
self.run_params["fontSize"] = 8
self.run_params["fontSize2"] = 7
else:
self.run_params["fontSize"] = 10
self.run_params["fontSize2"] = 9
wx.Frame.__init__(self, parent, id, title, size=(900, 710), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER |
wx.RESIZE_BOX |
wx.MAXIMIZE_BOX))
##########################################################
# Passed self here and removed the unnecessary second self
##########################################################
self.submissions = SubmissionPane(self, run_params)
self.CreateStatusBar()
menuBar = wx.MenuBar()
self.Centre()
self.Show()
class SubmissionPane(wx.Panel):
################################################
# changed the init here
################################################
def __init__(self, parent, run_params):
wx.Panel.__init__(self, parent)
self.parent = parent
self.selected_folders = None
self.params = run_params
################################################
# changed the ref below
################################################
self.frame = self
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.top_row_sizer = wx.BoxSizer(wx.HORIZONTAL);
radio_static_box = wx.StaticBox(self, label='Some Text')
radio_static_box_sizer = wx.StaticBoxSizer(radio_static_box, wx.HORIZONTAL)
job_static_box = wx.StaticBox(self, label='Some Text')
job_static_box_sizer = wx.StaticBoxSizer(job_static_box, wx.HORIZONTAL)
'''
radio_labels = ['Some Text', 'Some Text2']
self.radio_box = wx.RadioBox(
self, -1, "",
choices=radio_labels,
)
'''
self.radio1 = wx.RadioButton(self, label='Some Text', style=wx.RB_GROUP)
self.radio2 = wx.RadioButton(self, label='Some Text')
self.radio1.SetValue(True)
radio_static_box_sizer.Add(self.radio1, flag=wx.BOTTOM, border=0)
radio_static_box_sizer.Add(self.radio2, flag=wx.LEFT, border=10)
self.top_row_sizer.Add(radio_static_box_sizer, flag=wx.LEFT, border=10)
self.check_box = wx.CheckBox(self, label="Some Text")
self.check_box.SetValue(False)
if self.params["systemType"] == "Windows":
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(306, 14))
else:
self.txtTitle = wx.TextCtrl(self, style=wx.SUNKEN_BORDER, value="Some Text...", size=(200, -1), pos=(350, 19))
job_static_box_sizer.Add(self.check_box, flag=wx.LEFT, border=0)
self.top_row_sizer.Add(job_static_box_sizer, flag=wx.LEFT, border=10);
self.txtTitle.Show(False)
main_sizer.Add(self.top_row_sizer);
main_sizer.Add((-1, 10))
job_static_box2 = wx.StaticBox(self, label='Some Text')
third_row_sizer = wx.StaticBoxSizer(job_static_box2, wx.HORIZONTAL);
self.tc_files = wx.TextCtrl(self, size=(375, 25))
self.buttonGo = wx.Button(self, label='Go')
self.buttonGo.Bind(wx.EVT_BUTTON, self.OnSubmit)
third_row_sizer.Add(self.tc_files, flag=wx.RIGHT, border=8)
if self.params["systemType"] == "Windows":
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=0)
else:
third_row_sizer.Add(self.buttonGo, flag=wx.LEFT | wx.TOP, border=2)
main_sizer.Add(third_row_sizer, flag=wx.LEFT, border=10)
self.log_text22 = wx.ListCtrl(self,size=(875,275),
style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.LC_HRULES)
font = wx.Font(self.params["fontSize2"], wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.log_text22.SetFont(font)
self.log_text22.InsertColumn(1, '1', width=40, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(2, '2', width=50, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(3, '3', width=156)
self.log_text22.InsertColumn(4, '4', width=332)
self.log_text22.InsertColumn(5, '5', width=100, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(6, '6', width=82, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(7, '7', width=60, format=wx.LIST_FORMAT_CENTRE)
self.log_text22.InsertColumn(8, '8', width=50, format=wx.LIST_FORMAT_CENTRE)
main_sizer.Add((-1, 10))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.log_text22, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
self.running_log1 = wx.stc.StyledTextCtrl(self, -1, size=(875,175))
self.running_log1.StyleSetFont(wx.stc.STC_STYLE_DEFAULT, font)
self.running_log1.SetMarginWidth(1, 0)
self.running_log1.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, (0,0,0))
self.running_log1.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, (0,255,0))
self.running_log1.StyleClearAll()
main_sizer.Add((-1, 5))
list_sizer = wx.BoxSizer(wx.VERTICAL)
list_sizer.Add(self.running_log1, flag=wx.LEFT, border=10)
main_sizer.Add(list_sizer)
list_sizer.Add((-1, 10))
self.buttonClose = wx.Button(self, -1, "Quit")
list_sizer.Add(self.buttonClose, flag=wx.ALIGN_CENTER | wx.TOP | wx.LEFT, border=10)
self.SetBackgroundColour("Light Grey")
self.SetSizer(main_sizer)
self.Layout()
def OnSubmit(self, event):
msg = "Running"
jobSubmitmsg = wx.BusyInfo(msg, self)
time.sleep(3)
jobSubmitmsg = None
app = wx.App(redirect=False)
MainWindow(None, -1, 'Application')
app.MainLoop()