如果有人可以帮助我完成在dxf中生成图形的任务,我将感到非常高兴。即使没有gui一切正常,我也很难从tkinter输入字段获取输入。 我正在使用= self.a.get(),但似乎它没有从输入中获取数字。 这是我所做的:
from tkinter import *
import dxfwrite
from dxfwrite import DXFEngine as dxf
class GUI(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.fnameLabel = Label(master, text="height: ")
self.fnameLabel.grid(row=2, column=0, sticky=W)
self.a = DoubleVar()
self.a = Entry(master)
self.a.grid(row=2, column=1, sticky=W)
self.submitButton = Button(master, command=self.buttonClick,
text="generate drawing")
self.submitButton.grid()
def buttonClick(self):
a = self.a.get()
drawing = dxf.drawing('test111.dxf')
drawing.add_layer('lines')
a = float()
b = float()
b = 0.05
while True:
drawing.add(dxf.line((0.03, b), (a, b), color=40, layer='lines'))
b += 0.15
if b >= a + 1:
break
drawing.save()
if __name__ == "__main__":
guiFrame = GUI()
guiFrame.mainloop()
答案 0 :(得分:0)
当您将字符串转换为浮点型时,您必须告诉函数要转换的内容。如果不提供参数,则float函数将返回0.0。
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Customer</label>
@Html.DropDownListFor(x => x.CustomerId, new SelectList(Model.CustomerList, "Id", "UserName"), new { @class = "form-control select2", @id="emailadd", @placeholder = "" })
</div>
</div>
<div class="col-md-6">
<label></label>
<button type="button" class="btn btn-block btn-success" id="okbutton" style="width:60px;">OK</button>
</div>
<div id="voucher-result"></div>
</div>