Tkinter实例
这系列教程完全以代码的形式来写的,目标是:读者看代码和注释就可以理解代码的意思。虽然作者力求在每个例子中做到功能尽量少,代码尽量的简洁,但为了演示某个功能,不得不添加了一些额外的内容,如有疑问,请参考:《An Introduction To Tkinter》:这是介绍 Tkinter 我见过最全的一本书了http://docs.python.org/lib/tkinter.html:python 模块中介绍关于 Tkinter 编程的入门级教程http://www.tcl.tk/:Tk 的官方网站,最权威 Tk 资料。就是这本书的章节先后顺序,建议从前至后进行阅读。问题与反馈:如果在练习中有疑问或问题欢迎与我联系,一起讨论学习作者联系方式:傅客电邮于北京年月日初步结果教程之篇第一个例子使用内置位图改变的前景色和肯景色设置宽度与高度使用图像与文本文本的多行显小教程之篇第个例子的外观效果显示文本与图像的焦教程之篇的宽度与高度设置文本在控件上的显示位置改变的前景色与背景色设置的边框设置的外观效果设置状态绑定与变量教程之篇第一个程序与变量绑定设置为只读设冒为密码输入框验证输入的內容教程之篇第例设置的事件处理函数改变的显小文本将变量与绑定设置的状态值教程之第例子为指定组创建两个不同的组使用相同的绑定事件处理函数改变外观效果教程之篇第一个可以选中多个使用支持鼠标移动选中位置使向支持和中添加个删除中的选中或取消中的得到当前中的个数返回指定索引的返回当前选中的的索引判断一个是否被选中与变量绑定与事件绑定教程之篇第一个例子指定创建的参数绑定变量使用事件处理函数打印当前的值控制显示位数设置的标签属性设置取得的值教程之篇第·个例了创建时指定参数。设置的值绑定变量设置的事件处理函数的当前内容册除字符(这是个有问题的程序)在指定位置插入文本教程之篇第一个例子设置的位置使用事件处理函数(不建议这样使用)绑定将的解除绑定解除与的关系教程之篇第例子添加下拉菜单向菜单中添加项向菜单中添加顶向菜单中添加分隔符快捷菜单菜单项的操作方法教程之的常用方法教程之第例了改变的宽度设置宽高比例绑定变量文本对齐属性教程之创建设置的显示值打印的值使用作为的选项教程值向中添加删除指定的在指定位置添加个教程之第向实例中添加添加了的支持教程之创建简单的设置的属性使用自凵制作提示框教程之篇第一个例子向中添加文本仗用索引添加内容使用内置的控制添加位置使用表达式来增强教程之使用来指定文本的属性同时使用两个文本指定同一个属性控制的级别对文本块添加使用自定义对文本块添加使用获得中的内容测试对的影响使用对文本属性的影响教程之篇自定义的两个内置属性在中创建按钮在中创建一个图像未实现绑定与事件使用实现编辑常用功能未实现教程之篇第例了创建一个指定的填充色指定的边框颜色指定边框的宽度画虚线使用画刷填充修改的坐标教程之创建的多个使用同一个通过来访问向其它添加返回其它改变在中的顺序教程之篇移动删除缩放绑定与添加绑定事件绑定新的与现有的教程之绘制弧形设置弧形的样式设置弧形的角度绘制位图绘制图像绘制直线直线的属性绘制椭圆创建多边形修饰图形绘制文本选中文本创建组件教程之篇第一个例子的关系向中添加多个组件固定设置到自由变化如何控制子组件的布局如何控制组件的布局改变组件的排放位置设置组件之间的间隙大小教程之篇使用绝对坐标将组件放到指定的位置使用相对坐标放置组件位置使用同时指定多个组件同时使用相对和绝对坐标使用来指定放置的容器深入用法事件与结合使用教程之篇第一个例子使用和来指定位置为其它组件预定位置将组件放置到预定位置上去将两个或多个组件同一个位置改变列(行)的属性值组件使用多列(多行)设置表格中组件的对齐属性教程之篇第一个字体例子仗用系统已有的字体宇体创建属性优先级得到字体的属性值使用系统指定的字体教程之使用用模态对话框使用模块打开文件对话框保存文件对话框使用颜色对话框使用消息对话框使用缺省焦点教程之测试鼠标点击事件测试鼠标的移动事件测试鼠标的释放事件进入事件教程之篇测试离开事件响应特殊键响应所有的按键事件只处理指定的按键消息使用组合键响应事件改变组件人小事件教程之篇两个事件同时绑定到一个控件为一个绑定一个事件。事件各个级别音传递使用的后果使用绑定教程之篇第一个例子:指定显小的文本初始化创建一个使用编码,到现在为止还没有使用过直接通过“就可以完成的显示,必须含有此语句但是不需要(严格地说是必须不这样使用),否则解释器抱怨进入消息循环控件的显示步骤创建这个控件指定这个空间的,即这个控件属于哪一个告诉有一个控什产生了还有更简单的一个例子:将打印到标题上,也不用创建了再没法儿简化了,就这样吧使用内置位图指定显示的位图初始化创建一个,使用编码,到现在为止还没有使用过百接通过“就可以完成的。上面的代码使用了内置位图
- 2020-12-02下载
- 积分:1
平面变压器3D仿真资料
采用COMSOL软件,对平面变压器的仿真过程进行叙述,让大家了解平面变压器的仿真流程,是个很好的指导教材Solved with COMSOL Multiphysics 5.0Results and discussionThe magnetostatic analysis yields an inductance of 0. 1l mH and a dc resistance of0. 29 mQ2. Figure 2 shows the magnetic flux density norm and the electric potentialdistributionvolume: Coil potentiaL()Volume: Magnetic flux density norm (t▲0.07▲2.88×10-42.51.50.03050.01V656×107v0igure 2: Magnetic flux density norm and electric potential distribution for themagnetostatic analysisIn the static (DC) limit, the potential drop along the winding is purely resistive andcould in principle be computed separately and before the magnetic flux density iscomputed. When increasing the frequency, inductive effects start to limit the currentand skin effect makes it increasingly difficult to resolve the current distribution in thewinding. At sufficiently high frequency, the current is mainly flowing in a thin layernear the conductor surface. When increasing the frequency further. capacitive effectscome into play and current is flowing across the winding as displacement currentdensity. When going through the resonance frequency, the device goes from behavingas an inductor to become predominantly capacitive. At the self resonance, the resistivelosses peak due to the large internal currents Figure 4 shows the surface current3 MODELING OF A 3D INDUCTORSolved with COMSOL Multiphysics 5.0distribution atl MHz. Typical for high frequency the currents are displaced towardsthe edges of the conductor.freq(1)=1.0000E6_Surfaee: Surface-current density norm (A/)▲18618Q16010¥1.02Figure 3: Surface current density at I MHz (below the resonance frequency)Figure 4 shows how the resistive part of the coil impedance peaks at the resonancefrequency near 6MHz whereas Figure 5 shows how the reactive part of the coiimpedance changes sign and goes from inductive to capacitive when passing throughthe resonance4 MODELING OFA3DINDUCTORSolved with COMSOL Multiphysics 5.0Global: Lumped port impedance(Q2)d port impedance7.5G6.583275655545352510.10.20.30.40.509igure 4: Real part of the electric potential distribution5 MODELING OF A INDUCTORSolved with COMSOL Multiphysics 5.0Global: Lumped port impedance(Q2)35000Lumped port impedance200001000050000500010000-1500020000250000.10.20.30.40.50.60.70.809Figure 5: The reactive part of the coil impedance changes sign hen passing through theresonance frequency, going from inductive to capacitiveModel library path: ACDC_Module/Inductive_ Devices_and_coils/inductor 3dFrom the file menu. choose newNEWI In the new window click model wizardMODEL WIZARDI In the model wizard window click 3D2 In the Select physics tree, select AC/DC> Magnetic Fields(mf)3 Click Add4 Click StudyMODELING OF A3D NDUCTORSolved with COMSOL Multiphysics 5.05 In the Select study tree, select Preset Studies>StationaryGEOMETRYThe main geometry is imported from file. Air domains are typically not part of a CaDgeometry so they usually have to be added later. For convenience three additionaldomains have been defined in the CAd file. These are used to define a narrow feed gapwhere an excitation can be appliedport l(impl)I On the model toolbar, click Import2 In the Settings window for Import, locate the Import section3 Click Browse4 Browse to the models model library folder and double-click the filenductor 3d. mphbinSphere /(sphl)I On the Geometry toolbar, click Sphere2 In the Settings window for Sphere, locate the Size section3 In the Radius text field, type 0.2ick to expand the Layers section. In the table, enter the following settingsLayer nameThickness(m)ayer0.055 Click the Build All Objects buttonForm Union(fin)i On the Geometry toolbar, click Build AllClick the Zoom Extents button on the Graphics toolbar7 MODELING OF A 3D INDUCTORSolved with COMSOL Multiphysics 5.03 Click the Wireframe Rendering button on the Graphics toolbarThe geometry should now look as in the figure below0.1-0.10.20.0.0.1y0.0.2Next, define selections to be used when setting up materials and physics Start bdefining the domain group for the inductor winding and continue by adding otheruseful selectionsDEFINITIONSExplicitI On the Definitions toolbar, click Explicit2 In the Settings window for Explicit, in the Label text field, type Winding3 Select Domains 7,8 and 14 onlyI On the Definitions toolbar, click Explicit2 In the Settings window for Explicit, in the Label text field, type Gap3 Select domain 9 onlI On the Definitions toolbar, click Explicit8 MODELING OF A3DINDUCTORSolved with COMSOL Multiphysics 5.02 In the Settings window for Explicit, in the Label text field, type core3 Select Domain 6 onlyExplicit 4I On the Definitions toolbar, click Explicit2 In the Settings window for Explicit, in the Label text field, type InfiniteElements3 Select Domains 1-4 and 10-13 onlyExplicit 5I On the Definitions toolbar, click Explicit2 In the Settings window for Explicit, in the Label text field, type Non-conducting3 Select Domains 1-6 and 9-13 onlyI On the Definitions toolbar, click Explicit2 In the Settings window for Explicit, in the Label text field, type Non-conductingwithout Ie3 Select Domains 5, 6, and 9 only.Infinite Element Domain /(iel)Use infinite elements to emulate an infinite open space surrounding the inductorI On the definitions toolbar click Infinite element domain2 In the Settings window for Infinite Element Domain, locate the Domain Selectionsection3 From the Selection list. choose Infinite Elements4 Locate the Geometry section From the Type list, choose SphericalNext define the material settingsADD MATERIALI On the Model toolbar, click Add Material to open the add Material window2 Go to the Add material window3 In the tree, select AC/DC>Copper.4 Click Add to Component in the window toolbar9 MODELING OF A 3D INDUCTORSolved with COMSOL Multiphysics 5.0MATERIALSCopper(mat/)I In the Model Builder window, under Component I(comp l)>Materials click Copper(matD)2 In the Settings window for Material, locate the Geometric Entity Selection section3 From the Selection list, choose windingADD MATERIALI Go to the Add Material window2 In the tree. select built-In>Air3 Click Add to Component in the window toolbarMATERIALSAir(mat2I In the Model Builder window, under Component I(comp l)>Materials click Air(mat2)2 In the Settings window for Material, locate the Geometric Entity Selection section3 From the Selection list, choose Non-conductingThe core material is not part of the material library so it is entered as a user-definedmateriaMaterial 3(mat3)I In the Model Builder window, right-click Materials and choose Blank Material2 In the Settings window for Material, in the Label text field, type Core3 Locate the geometric Entity Selection section4 From the selection list choose Core5 Locate the Material Contents section. In the table, enter the following settingsPropertName Value Unit Property groupElectrical conductivity sigma0S/IBasicRelative permittivity epsilonrBasicRelative permeability mur1e3Basic6 On the model toolbar. click Add Material to close the Add Material windowMAGNETIC FIELDS (MF)Select Domains 1-8 and 10-14 only0MODELING OF A 3D INDUCTOR
- 2020-12-10下载
- 积分:1