基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包

文章目录

  • 1.前言
  • 2.wxFormBuilder实现进制转换器的UI界面
    • 2.1 object tree及各组件功能说明
    • 2.2 转换器UI界面
  • 3.主函数实现按钮事件处理
  • 4.fbp文件
  • 5. pyinstaller打包成可执行文件

1.前言

  日常的学习生活中常常会用到进制转换如2-8-10-16互转,笔算当然可以解决但长度过长的时候难免会有些计算繁琐,当然在线的进制转换网站一大堆,主要想每次需要用到时不想再百度找。进制转换用Python实现很简单,设计一个简单的界面,打包成可执行文件方便使用,于是用wxFormBuilder构建转换器的UI界面,用wxpython库实现完整的功能。

2.wxFormBuilder实现进制转换器的UI界面

2.1 object tree及各组件功能说明

基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包_第1张图片

组件 功能 组件
m_staticText_1_2 静态文本 2: m_textCtrl_1 2进制输入(初始值:请输入2进制)
m_staticText_2_8 静态文本 8: m_textCtrl_2 8进制输入(初始值:请输入8进制)
m_staticText_3_10 静态文本 10: m_textCtrl_3 10进制输入(初始值:请输入10进制)
m_staticText_4_16 静态文本 16: m_textCtrl_4 16进制输入(初始值:请输入16进制)
tranform 点击按钮实现输入进制到其他进制转换
reduction 点击按钮还原到初始状态

2.2 转换器UI界面

基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包_第2张图片
用wxFormBuilder生成GUI界面类MainFrame

# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc


###########################################################################
## Class MainFrame
###########################################################################

class MainFrame(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"进制转换器", pos=wx.DefaultPosition, size=wx.Size(390, 350),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT))

        gSizer1 = wx.GridSizer(5, 2, 0, 0)

        self.m_staticText_1_2 = wx.StaticText(self, wx.ID_ANY, u"2 :", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText_1_2.Wrap(-1)

        self.m_staticText_1_2.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        gSizer1.Add(self.m_staticText_1_2, 0, wx.ALL, 5)

        self.m_textCtrl_1 = wx.TextCtrl(self, wx.ID_ANY, u"请输入2进制", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_textCtrl_1.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))

        gSizer1.Add(self.m_textCtrl_1, 0, wx.ALL, 5)

        self.m_staticText_2_8 = wx.StaticText(self, wx.ID_ANY, u"8 :", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText_2_8.Wrap(-1)

        self.m_staticText_2_8.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        gSizer1.Add(self.m_staticText_2_8, 0, wx.ALL, 5)

        self.m_textCtrl_2 = wx.TextCtrl(self, wx.ID_ANY, u"请输入8进制", wx.DefaultPosition, wx.Size(120, -1), 0)
        gSizer1.Add(self.m_textCtrl_2, 0, wx.ALL, 5)

        self.m_staticText_3_8 = wx.StaticText(self, wx.ID_ANY, u"10 :", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText_3_8.Wrap(-1)

        self.m_staticText_3_8.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        gSizer1.Add(self.m_staticText_3_8, 0, wx.ALL, 5)

        self.m_textCtrl_3 = wx.TextCtrl(self, wx.ID_ANY, u"请输入10进制", wx.DefaultPosition, wx.Size(120, -1), 0)
        gSizer1.Add(self.m_textCtrl_3, 0, wx.ALL, 5)

        self.m_staticText_4_16 = wx.StaticText(self, wx.ID_ANY, u"16 :", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText_4_16.Wrap(-1)

        self.m_staticText_4_16.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        gSizer1.Add(self.m_staticText_4_16, 0, wx.ALL, 5)

        self.m_textCtrl_4 = wx.TextCtrl(self, wx.ID_ANY, u"请输入16进制", wx.DefaultPosition, wx.Size(120, -1), 0)
        gSizer1.Add(self.m_textCtrl_4, 0, wx.ALL, 5)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        self.transform = wx.Button(self, wx.ID_ANY, u"转换", wx.DefaultPosition, wx.DefaultSize, 0)
        self.transform.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK))

        bSizer4.Add(self.transform, 0, wx.ALL, 5)

        self.reduction = wx.Button(self, wx.ID_ANY, u"还原", wx.DefaultPosition, wx.DefaultSize, 0)
        self.reduction.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION))

        bSizer4.Add(self.reduction, 0, wx.ALL, 5)

        gSizer1.Add(bSizer4, 1, wx.ALIGN_CENTER_HORIZONTAL, 5)

        self.SetSizer(gSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.transform.Bind(wx.EVT_BUTTON, self.answer)
        self.reduction.Bind(wx.EVT_BUTTON, self.red_answer)

    def __del__(self):
        pass

    # Virtual event handlers, override them in your derived class
    def answer(self, event):
        event.Skip()

    def red_answer(self, event):
        event.Skip()

answer, red_anser方法实现两个按钮事件处理。

3.主函数实现按钮事件处理

  用主函数文件去调用MainFrame类,并实现两个按钮的功能

import wx
from base_transf import MainFrame


class transFrame(MainFrame):
    # 进制转换
    def answer(self, event):
        base_2 = ''
        base_8 = ''
        base_10 = ''
        base_16 = ''
        # 2 进制转 8,10,16
        if self.m_textCtrl_1.Value != '请输入2进制':
            # print(type(self.m_textCtrl_1.Value))
            # 
            # 2 转 8
            base_8 = oct(int(self.m_textCtrl_1.Value, 2))[2:]
            self.m_textCtrl_2.Clear()
            self.m_textCtrl_2.AppendText(base_8)

            # 2 转 10
            base_10 = str(int(self.m_textCtrl_1.Value, 2))
            self.m_textCtrl_3.Clear()
            self.m_textCtrl_3.AppendText(base_10)
            # 2 转 16
            base_16 = hex(int(self.m_textCtrl_1.Value, 2))[2:]
            self.m_textCtrl_4.Clear()
            self.m_textCtrl_4.AppendText(base_16)

        # 8 转 2, 10, 16
        elif self.m_textCtrl_2.Value != '请输入8进制':
            # 8 转 2
            base_2 = bin(int(self.m_textCtrl_2.Value, 8))[2:]
            self.m_textCtrl_1.Clear()
            self.m_textCtrl_1.AppendText(base_2)
            # 8 转 10
            base_10 = str(int(self.m_textCtrl_2.Value, 8))
            self.m_textCtrl_3.Clear()
            self.m_textCtrl_3.AppendText(base_10)
            # 8 转 16
            base_16 = hex(int(self.m_textCtrl_2.Value, 8))[2:]
            self.m_textCtrl_4.Clear()
            self.m_textCtrl_4.AppendText(base_16)

        # 10 转 2, 8, 16
        elif self.m_textCtrl_3.Value != '请输入10进制':
            # 10 转 2
            base_2 = bin(int(self.m_textCtrl_3.Value))[2:]
            self.m_textCtrl_1.Clear()
            self.m_textCtrl_1.AppendText(base_2)
            # 10 转 8
            base_8 = oct(int(self.m_textCtrl_3.Value))[2:]
            self.m_textCtrl_2.Clear()
            self.m_textCtrl_2.AppendText(base_8)
            # 10 转 16
            base_16 = hex(int(self.m_textCtrl_3.Value))[2:]
            self.m_textCtrl_4.Clear()
            self.m_textCtrl_4.AppendText(base_16)

        # 16 转 2, 8, 10
        elif self.m_textCtrl_4.Value != '请输入16进制':
            # 16 转 2
            base_2 = bin(int(self.m_textCtrl_4.Value, 16))[2:]
            self.m_textCtrl_1.Clear()
            self.m_textCtrl_1.AppendText(base_2)
            # 16 转 8
            base_8 = oct(int(self.m_textCtrl_4.Value, 16))[2:]
            self.m_textCtrl_2.Clear()
            self.m_textCtrl_2.AppendText(base_8)
            # 16 转 10
            base_10 = str(int(self.m_textCtrl_4.Value, 16))
            self.m_textCtrl_3.Clear()
            self.m_textCtrl_3.AppendText(base_10)

    # 还原
    def red_answer(self, event):
        self.m_textCtrl_1.Clear()
        self.m_textCtrl_1.AppendText('请输入2进制')

        self.m_textCtrl_2.Clear()
        self.m_textCtrl_2.AppendText('请输入8进制')

        self.m_textCtrl_3.Clear()
        self.m_textCtrl_3.AppendText('请输入10进制')

        self.m_textCtrl_4.Clear()
        self.m_textCtrl_4.AppendText('请输入16进制')


app = wx.App()
transFrame(None).Show()
app.MainLoop()

4.fbp文件


<wxFormBuilder_Project>
    <FileVersion major="1" minor="16" />
    <object class="Project" expanded="1">
        <property name="class_decoration">; property>
        <property name="code_generation">Pythonproperty>
        <property name="disconnect_events">1property>
        <property name="disconnect_mode">source_nameproperty>
        <property name="disconnect_php_events">0property>
        <property name="disconnect_python_events">0property>
        <property name="embedded_files_path">resproperty>
        <property name="encoding">UTF-8property>
        <property name="event_generation">connectproperty>
        <property name="file">base_transfproperty>
        <property name="first_id">1000property>
        <property name="help_provider">noneproperty>
        <property name="image_path_wrapper_function_name">property>
        <property name="indent_with_spaces">property>
        <property name="internationalize">0property>
        <property name="name">MyProject2property>
        <property name="namespace">property>
        <property name="path">.property>
        <property name="precompiled_header">property>
        <property name="relative_path">1property>
        <property name="skip_lua_events">1property>
        <property name="skip_php_events">1property>
        <property name="skip_python_events">1property>
        <property name="ui_table">UIproperty>
        <property name="use_array_enum">0property>
        <property name="use_enum">0property>
        <property name="use_microsoft_bom">0property>
        <object class="Frame" expanded="1">
            <property name="aui_managed">0property>
            <property name="aui_manager_style">wxAUI_MGR_DEFAULTproperty>
            <property name="bg">wxSYS_COLOUR_3DLIGHTproperty>
            <property name="center">wxBOTHproperty>
            <property name="context_help">property>
            <property name="context_menu">1property>
            <property name="enabled">1property>
            <property name="event_handler">impl_virtualproperty>
            <property name="extra_style">property>
            <property name="fg">property>
            <property name="font">property>
            <property name="hidden">0property>
            <property name="id">wxID_ANYproperty>
            <property name="maximum_size">property>
            <property name="minimum_size">property>
            <property name="name">MainFrameproperty>
            <property name="pos">property>
            <property name="size">390,350property>
            <property name="style">wxDEFAULT_FRAME_STYLEproperty>
            <property name="subclass">; ; forward_declareproperty>
            <property name="title">进制转换器property>
            <property name="tooltip">property>
            <property name="two_step_creation">0property>
            <property name="window_extra_style">property>
            <property name="window_name">property>
            <property name="window_style">wxTAB_TRAVERSALproperty>
            <property name="xrc_skip_sizer">1property>
            <object class="wxGridSizer" expanded="0">
                <property name="cols">2property>
                <property name="hgap">0property>
                <property name="minimum_size">property>
                <property name="name">gSizer1property>
                <property name="permission">noneproperty>
                <property name="rows">5property>
                <property name="vgap">0property>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxStaticText" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">wxSYS_COLOUR_INACTIVECAPTIONproperty>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="label">2 :property>
                        <property name="markup">0property>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_staticText_1_2property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                        <property name="wrap">-1property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxTextCtrl" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">wxSYS_COLOUR_WINDOWproperty>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="maxlength">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_textCtrl_1property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">120,-1property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="validator_data_type">property>
                        <property name="validator_style">wxFILTER_NONEproperty>
                        <property name="validator_type">wxDefaultValidatorproperty>
                        <property name="validator_variable">property>
                        <property name="value">请输入2进制property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxStaticText" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">wxSYS_COLOUR_INACTIVECAPTIONproperty>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="label">8 :property>
                        <property name="markup">0property>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_staticText_2_8property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                        <property name="wrap">-1property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxTextCtrl" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">property>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="maxlength">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_textCtrl_2property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">120,-1property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="validator_data_type">property>
                        <property name="validator_style">wxFILTER_NONEproperty>
                        <property name="validator_type">wxDefaultValidatorproperty>
                        <property name="validator_variable">property>
                        <property name="value">请输入8进制property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxStaticText" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">wxSYS_COLOUR_INACTIVECAPTIONproperty>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="label">10 :property>
                        <property name="markup">0property>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_staticText_3_8property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                        <property name="wrap">-1property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxTextCtrl" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">property>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="maxlength">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_textCtrl_3property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">120,-1property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="validator_data_type">property>
                        <property name="validator_style">wxFILTER_NONEproperty>
                        <property name="validator_type">wxDefaultValidatorproperty>
                        <property name="validator_variable">property>
                        <property name="value">请输入10进制property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxStaticText" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">wxSYS_COLOUR_INACTIVECAPTIONproperty>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="label">16 :property>
                        <property name="markup">0property>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_staticText_4_16property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                        <property name="wrap">-1property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALLproperty>
                    <property name="proportion">0property>
                    <object class="wxTextCtrl" expanded="0">
                        <property name="BottomDockable">1property>
                        <property name="LeftDockable">1property>
                        <property name="RightDockable">1property>
                        <property name="TopDockable">1property>
                        <property name="aui_layer">property>
                        <property name="aui_name">property>
                        <property name="aui_position">property>
                        <property name="aui_row">property>
                        <property name="best_size">property>
                        <property name="bg">property>
                        <property name="caption">property>
                        <property name="caption_visible">1property>
                        <property name="center_pane">0property>
                        <property name="close_button">1property>
                        <property name="context_help">property>
                        <property name="context_menu">1property>
                        <property name="default_pane">0property>
                        <property name="dock">Dockproperty>
                        <property name="dock_fixed">0property>
                        <property name="docking">Leftproperty>
                        <property name="enabled">1property>
                        <property name="fg">property>
                        <property name="floatable">1property>
                        <property name="font">property>
                        <property name="gripper">0property>
                        <property name="hidden">0property>
                        <property name="id">wxID_ANYproperty>
                        <property name="max_size">property>
                        <property name="maximize_button">0property>
                        <property name="maximum_size">property>
                        <property name="maxlength">property>
                        <property name="min_size">property>
                        <property name="minimize_button">0property>
                        <property name="minimum_size">property>
                        <property name="moveable">1property>
                        <property name="name">m_textCtrl_4property>
                        <property name="pane_border">1property>
                        <property name="pane_position">property>
                        <property name="pane_size">property>
                        <property name="permission">protectedproperty>
                        <property name="pin_button">1property>
                        <property name="pos">property>
                        <property name="resize">Resizableproperty>
                        <property name="show">1property>
                        <property name="size">120,-1property>
                        <property name="style">property>
                        <property name="subclass">; ; forward_declareproperty>
                        <property name="toolbar_pane">0property>
                        <property name="tooltip">property>
                        <property name="validator_data_type">property>
                        <property name="validator_style">wxFILTER_NONEproperty>
                        <property name="validator_type">wxDefaultValidatorproperty>
                        <property name="validator_variable">property>
                        <property name="value">请输入16进制property>
                        <property name="window_extra_style">property>
                        <property name="window_name">property>
                        <property name="window_style">property>
                    object>
                object>
                <object class="sizeritem" expanded="0">
                    <property name="border">5property>
                    <property name="flag">wxALIGN_CENTER_HORIZONTALproperty>
                    <property name="proportion">1property>
                    <object class="wxBoxSizer" expanded="0">
                        <property name="minimum_size">property>
                        <property name="name">bSizer4property>
                        <property name="orient">wxHORIZONTALproperty>
                        <property name="permission">noneproperty>
                        <object class="sizeritem" expanded="0">
                            <property name="border">5property>
                            <property name="flag">wxALLproperty>
                            <property name="proportion">0property>
                            <object class="wxButton" expanded="0">
                                <property name="BottomDockable">1property>
                                <property name="LeftDockable">1property>
                                <property name="RightDockable">1property>
                                <property name="TopDockable">1property>
                                <property name="aui_layer">property>
                                <property name="aui_name">property>
                                <property name="aui_position">property>
                                <property name="aui_row">property>
                                <property name="auth_needed">0property>
                                <property name="best_size">property>
                                <property name="bg">wxSYS_COLOUR_INFOBKproperty>
                                <property name="bitmap">property>
                                <property name="caption">property>
                                <property name="caption_visible">1property>
                                <property name="center_pane">0property>
                                <property name="close_button">1property>
                                <property name="context_help">property>
                                <property name="context_menu">1property>
                                <property name="current">property>
                                <property name="default">0property>
                                <property name="default_pane">0property>
                                <property name="disabled">property>
                                <property name="dock">Dockproperty>
                                <property name="dock_fixed">0property>
                                <property name="docking">Leftproperty>
                                <property name="enabled">1property>
                                <property name="fg">property>
                                <property name="floatable">1property>
                                <property name="focus">property>
                                <property name="font">property>
                                <property name="gripper">0property>
                                <property name="hidden">0property>
                                <property name="id">wxID_ANYproperty>
                                <property name="label">转换property>
                                <property name="margins">property>
                                <property name="markup">0property>
                                <property name="max_size">property>
                                <property name="maximize_button">0property>
                                <property name="maximum_size">property>
                                <property name="min_size">property>
                                <property name="minimize_button">0property>
                                <property name="minimum_size">property>
                                <property name="moveable">1property>
                                <property name="name">transformproperty>
                                <property name="pane_border">1property>
                                <property name="pane_position">property>
                                <property name="pane_size">property>
                                <property name="permission">protectedproperty>
                                <property name="pin_button">1property>
                                <property name="pos">property>
                                <property name="position">property>
                                <property name="pressed">property>
                                <property name="resize">Resizableproperty>
                                <property name="show">1property>
                                <property name="size">property>
                                <property name="style">property>
                                <property name="subclass">; ; forward_declareproperty>
                                <property name="toolbar_pane">0property>
                                <property name="tooltip">property>
                                <property name="validator_data_type">property>
                                <property name="validator_style">wxFILTER_NONEproperty>
                                <property name="validator_type">wxDefaultValidatorproperty>
                                <property name="validator_variable">property>
                                <property name="window_extra_style">property>
                                <property name="window_name">property>
                                <property name="window_style">property>
                                <event name="OnButtonClick">answerevent>
                            object>
                        object>
                        <object class="sizeritem" expanded="0">
                            <property name="border">5property>
                            <property name="flag">wxALLproperty>
                            <property name="proportion">0property>
                            <object class="wxButton" expanded="0">
                                <property name="BottomDockable">1property>
                                <property name="LeftDockable">1property>
                                <property name="RightDockable">1property>
                                <property name="TopDockable">1property>
                                <property name="aui_layer">property>
                                <property name="aui_name">property>
                                <property name="aui_position">property>
                                <property name="aui_row">property>
                                <property name="auth_needed">0property>
                                <property name="best_size">property>
                                <property name="bg">wxSYS_COLOUR_ACTIVECAPTIONproperty>
                                <property name="bitmap">property>
                                <property name="caption">property>
                                <property name="caption_visible">1property>
                                <property name="center_pane">0property>
                                <property name="close_button">1property>
                                <property name="context_help">property>
                                <property name="context_menu">1property>
                                <property name="current">property>
                                <property name="default">0property>
                                <property name="default_pane">0property>
                                <property name="disabled">property>
                                <property name="dock">Dockproperty>
                                <property name="dock_fixed">0property>
                                <property name="docking">Leftproperty>
                                <property name="enabled">1property>
                                <property name="fg">property>
                                <property name="floatable">1property>
                                <property name="focus">property>
                                <property name="font">property>
                                <property name="gripper">0property>
                                <property name="hidden">0property>
                                <property name="id">wxID_ANYproperty>
                                <property name="label">还原property>
                                <property name="margins">property>
                                <property name="markup">0property>
                                <property name="max_size">property>
                                <property name="maximize_button">0property>
                                <property name="maximum_size">property>
                                <property name="min_size">property>
                                <property name="minimize_button">0property>
                                <property name="minimum_size">property>
                                <property name="moveable">1property>
                                <property name="name">reductionproperty>
                                <property name="pane_border">1property>
                                <property name="pane_position">property>
                                <property name="pane_size">property>
                                <property name="permission">protectedproperty>
                                <property name="pin_button">1property>
                                <property name="pos">property>
                                <property name="position">property>
                                <property name="pressed">property>
                                <property name="resize">Resizableproperty>
                                <property name="show">1property>
                                <property name="size">property>
                                <property name="style">property>
                                <property name="subclass">; ; forward_declareproperty>
                                <property name="toolbar_pane">0property>
                                <property name="tooltip">property>
                                <property name="validator_data_type">property>
                                <property name="validator_style">wxFILTER_NONEproperty>
                                <property name="validator_type">wxDefaultValidatorproperty>
                                <property name="validator_variable">property>
                                <property name="window_extra_style">property>
                                <property name="window_name">property>
                                <property name="window_style">property>
                                <event name="OnButtonClick">red_answerevent>
                            object>
                        object>
                    object>
                object>
            object>
        object>
    object>
wxFormBuilder_Project>

5. pyinstaller打包成可执行文件

将两个py文件放在同一目录结构下:

pyinstaller -F -w  主函数文件名.py

可执行文件
基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包_第3张图片

基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包_第4张图片
基于wxpython和wxformbuilder实现的简单2-8-10-16进制转换器,并用pyinstaller打包_第5张图片

你可能感兴趣的:(Python,python,wxpython,wxFormBuilder)