Last active
May 23, 2018 06:26
-
-
Save pythonsuezo/2993fc7f785abd34a7ae0067853a8210 to your computer and use it in GitHub Desktop.
なんやかんや通信するソフトのフレームを表示するコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
########################################################################### | |
## Python code generated with wxFormBuilder (version Nov 6 2017) | |
## http://www.wxformbuilder.org/ | |
## | |
## PLEASE DO *NOT* EDIT THIS FILE! | |
########################################################################### | |
import wx | |
import wx.xrc | |
########################################################################### | |
## Class MyFrame1 | |
########################################################################### | |
class MyFrame1 ( wx.Frame ): | |
def __init__( self, parent ): | |
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"なんやかんや通信する奴", pos = wx.DefaultPosition, size = wx.Size( 465,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.RESIZE_BORDER|wx.TAB_TRAVERSAL ) | |
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) | |
bSizer1 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) | |
self.m_panel1.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOTEXT ) ) | |
self.m_panel1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) | |
bSizer47 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_staticText24 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText24.Wrap( -1 ) | |
bSizer47.Add( self.m_staticText24, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) | |
self.m_panel1.SetSizer( bSizer47 ) | |
self.m_panel1.Layout() | |
bSizer47.Fit( self.m_panel1 ) | |
bSizer1.Add( self.m_panel1, 1, wx.EXPAND, 5 ) | |
self.SetSizer( bSizer1 ) | |
self.Layout() | |
self.Centre( wx.BOTH ) | |
# Connect Events | |
self.Bind( wx.EVT_CLOSE, self.ExitHandler ) | |
def __del__( self ): | |
pass | |
# Virtual event handlers, overide them in your derived class | |
def ExitHandler( self, event ): | |
event.Skip() | |
########################################################################### | |
## Class MyDialog1 | |
########################################################################### | |
class MyDialog1 ( wx.Dialog ): | |
def __init__( self, parent ): | |
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"なんやかんや通信する奴", pos = wx.DefaultPosition, size = wx.Size( 490,309 ), style = wx.DEFAULT_DIALOG_STYLE ) | |
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) | |
bSizer1 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) | |
self.m_panel1.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOTEXT ) ) | |
self.m_panel1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) ) | |
bSizer2 = wx.BoxSizer( wx.VERTICAL ) | |
sbSizer2 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel1, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL ) | |
bSizer8 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_radioBtn1 = wx.RadioButton( sbSizer2.GetStaticBox(), wx.ID_ANY, u"TCP/IP", wx.DefaultPosition, wx.DefaultSize, wx.RB_SINGLE ) | |
bSizer8.Add( self.m_radioBtn1, 0, wx.ALL, 5 ) | |
sbSizer2.Add( bSizer8, 0, wx.EXPAND, 5 ) | |
bSizer9 = wx.BoxSizer( wx.HORIZONTAL ) | |
bSizer10 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_staticText3 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u"ホスト:", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText3.Wrap( -1 ) | |
bSizer10.Add( self.m_staticText3, 0, wx.ALL, 5 ) | |
self.m_staticText7 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText7.Wrap( -1 ) | |
bSizer10.Add( self.m_staticText7, 0, wx.ALL, 3 ) | |
self.m_staticText8 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u"サービス:", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText8.Wrap( -1 ) | |
bSizer10.Add( self.m_staticText8, 0, wx.ALL, 5 ) | |
bSizer9.Add( bSizer10, 0, wx.EXPAND, 5 ) | |
bSizer11 = wx.BoxSizer( wx.VERTICAL ) | |
bSizer12 = wx.BoxSizer( wx.VERTICAL ) | |
m_comboBox1Choices = [] | |
self.m_comboBox1 = wx.ComboBox( sbSizer2.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox1Choices, wx.CB_DROPDOWN ) | |
bSizer12.Add( self.m_comboBox1, 0, wx.EXPAND, 5 ) | |
bSizer11.Add( bSizer12, 0, wx.EXPAND, 5 ) | |
bSizer14 = wx.BoxSizer( wx.HORIZONTAL ) | |
bSizer15 = wx.BoxSizer( wx.VERTICAL ) | |
self.m_checkBox2 = wx.CheckBox( sbSizer2.GetStaticBox(), wx.ID_ANY, u"履歴", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_checkBox2.SetValue(True) | |
bSizer15.Add( self.m_checkBox2, 0, wx.ALL, 5 ) | |
self.m_radioBtn2 = wx.RadioButton( sbSizer2.GetStaticBox(), wx.ID_ANY, u"Telnet", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_radioBtn2.SetValue( True ) | |
bSizer15.Add( self.m_radioBtn2, 0, wx.ALL, 5 ) | |
bSizer14.Add( bSizer15, 1, wx.EXPAND, 5 ) | |
bSizer16 = wx.BoxSizer( wx.VERTICAL ) | |
bSizer17 = wx.BoxSizer( wx.HORIZONTAL ) | |
self.m_staticText4 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u"TCPポート:", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText4.Wrap( -1 ) | |
bSizer17.Add( self.m_staticText4, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) | |
self.m_textCtrl1 = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"22", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_textCtrl1.SetMaxLength( 5 ) | |
bSizer17.Add( self.m_textCtrl1, 1, wx.ALL|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
bSizer16.Add( bSizer17, 1, wx.ALIGN_RIGHT, 5 ) | |
bSizer18 = wx.BoxSizer( wx.HORIZONTAL ) | |
self.m_staticText5 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u"SSHバージョン:", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText5.Wrap( -1 ) | |
bSizer18.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
self.m_textCtrl2 = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"まだむり", wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) | |
bSizer18.Add( self.m_textCtrl2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
bSizer16.Add( bSizer18, 1, wx.EXPAND, 5 ) | |
bSizer19 = wx.BoxSizer( wx.HORIZONTAL ) | |
self.m_staticText6 = wx.StaticText( sbSizer2.GetStaticBox(), wx.ID_ANY, u"プロトコル:", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText6.Wrap( -1 ) | |
bSizer19.Add( self.m_staticText6, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
m_comboBox2Choices = [ u"UNSPEC", u"IPv6", u"IPV4" ] | |
self.m_comboBox2 = wx.ComboBox( sbSizer2.GetStaticBox(), wx.ID_ANY, u"UNSPEC", wx.DefaultPosition, wx.DefaultSize, m_comboBox2Choices, 0 ) | |
bSizer19.Add( self.m_comboBox2, 1, wx.ALL, 5 ) | |
bSizer16.Add( bSizer19, 1, wx.EXPAND, 5 ) | |
bSizer14.Add( bSizer16, 1, wx.EXPAND, 5 ) | |
bSizer11.Add( bSizer14, 1, wx.EXPAND, 5 ) | |
bSizer9.Add( bSizer11, 1, wx.EXPAND, 5 ) | |
sbSizer2.Add( bSizer9, 1, wx.EXPAND, 5 ) | |
bSizer2.Add( sbSizer2, 1, wx.ALL|wx.EXPAND, 5 ) | |
sbSizer3 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel1, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL ) | |
self.m_radioBtn3 = wx.RadioButton( sbSizer3.GetStaticBox(), wx.ID_ANY, u"シリアル", wx.DefaultPosition, wx.DefaultSize, wx.RB_SINGLE ) | |
sbSizer3.Add( self.m_radioBtn3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
self.m_staticText9 = wx.StaticText( sbSizer3.GetStaticBox(), wx.ID_ANY, u"ポート", wx.DefaultPosition, wx.DefaultSize, 0 ) | |
self.m_staticText9.Wrap( -1 ) | |
sbSizer3.Add( self.m_staticText9, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
m_comboBox3Choices = [] | |
self.m_comboBox3 = wx.ComboBox( sbSizer3.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox3Choices, wx.CB_READONLY ) | |
sbSizer3.Add( self.m_comboBox3, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) | |
bSizer2.Add( sbSizer3, 0, wx.ALL|wx.EXPAND, 5 ) | |
m_sdbSizer1 = wx.StdDialogButtonSizer() | |
self.m_sdbSizer1OK = wx.Button( self.m_panel1, wx.ID_OK ) | |
m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) | |
self.m_sdbSizer1Cancel = wx.Button( self.m_panel1, wx.ID_CANCEL ) | |
m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel ) | |
self.m_sdbSizer1Help = wx.Button( self.m_panel1, wx.ID_HELP ) | |
m_sdbSizer1.AddButton( self.m_sdbSizer1Help ) | |
m_sdbSizer1.Realize(); | |
bSizer2.Add( m_sdbSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 ) | |
self.m_panel1.SetSizer( bSizer2 ) | |
self.m_panel1.Layout() | |
bSizer2.Fit( self.m_panel1 ) | |
bSizer1.Add( self.m_panel1, 1, wx.EXPAND, 5 ) | |
self.SetSizer( bSizer1 ) | |
self.Layout() | |
self.Centre( wx.BOTH ) | |
# Connect Events | |
self.m_sdbSizer1OK.Bind( wx.EVT_BUTTON, self.Dialog_ok ) | |
def __del__( self ): | |
pass | |
# Virtual event handlers, overide them in your derived class | |
def Dialog_ok( self, event ): | |
event.Skip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
import teraframe | |
class Mainframe( teraframe.MyFrame1 ): | |
def __init__( self, parent ): | |
teraframe.MyFrame1.__init__( self, parent ) | |
subframe = MyDialog1( None ) | |
result = subframe.ShowModal() | |
print(result) | |
if result == wx.ID_OK: | |
print("OK",subframe.m_comboBox1.GetValue()) | |
self.m_staticText24.SetLabel(subframe.m_comboBox1.GetValue()) | |
else: | |
print("NO") | |
def ExitHandler( self, event ): | |
exit() | |
class MyDialog1( teraframe.MyDialog1 ): | |
def __init__( self, parent ): | |
teraframe.MyDialog1.__init__( self, parent ) | |
app = wx.App( False ) | |
frame = Mainframe( None ) | |
frame.Show(True) | |
app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment