展开全部
下面的代码是创建一个立方体'''
This examples creates and displays a simple box.
'''
# The first line loads the init_display function, necessary to
# enable the builtin simple gui provided with pythonocc
from OCC.Display.SimpleGui import init_display
# Then we import the class that instanciates a box
# Here the BRepPrimAPI module means Boundary Representation Primitive API.
# It provides an API for creation of basic geometries like spheres,cones etc
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
# Following line initializes the display
# By default, the init_display function looks for a Qt based Gui (PyQt, PySide)
display, start_display, add_menu, add_function_to_menu = init_display()
# The BRepPrimAPI_MakeBox class is initialized with the 3 parameters of the box: widht, height, depth
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
# Then the box shape is sent to the renderer
display.DisplayShape(my_box, update=True)
# At last, we enter the gui mainloop
start_display()
创建页面#coding:utf8
import wx
app = wx.App() #创建对象62616964757a686964616fe59b9ee7ad9431333363373738
win = wx.Frame(None,title="ahuang1900", size=(410,340)) #创建窗口对象
wx.Button(win, label="open", pos = (245,5), size=(80,25)) #创建按钮1
wx.Button(win, label="save", pos = (325,5), size=(80,25)) #创建按钮2
wx.TextCtrl(win, pos=(5,5), size=(240,25)) #创建文本框1
#创建文本框2
wx.TextCtrl(win, pos=(5,35), size=(400,300), style=wx.TE_MULTILINE|wx.HSCROLL)
win.Show() #显示
app.MainLoop() #主事件循环