1

我有一个产生数字列的函数:

    def distancesplit(self):
       img = np.asarray(Image.open("testtwo.tif").convert('L'))                            
       img = 1 * (img < 127)

       areasplit = np.split(img.ravel(), 24) # here we are splitting converted to 1D array
       for i in areasplit:
       area = (i == 0).sum()
       print area

我想在 Fl_Text_Editor 小部件上输出“区域”结果。这是我现在拥有的代码:

window = Fl_Window(100,100,400,400) # creating FLTK window
window.label(sys.argv[0])
button = Fl_Button(9,20,180,50) # making button class instance
button.label("Compute area")
button.callback(pixelarea) # connecting button to the function

button_two = Fl_Button(9,80,180,50)
button_two.label("Compute distances")
button_two.callback(distancesplit)

button_three = Fl_Button(9,140,180,50)
button_three.label("Compute features")
button_three.callback(distancetwo)

textedit = Fl_Text_Editor(9, 220, 180, 50)
textedit.buffer(self.textbuffer)
textedit.label("Text Editor")


textbuffer = Fl_Text_Buffer()
textbuffer.text("Code is written by the emotionally unstable alien who had survived    space aircraft collision")

window.end() # code for running FLTK construction of widgets
window.show(len(sys.argv), sys.argv)
Fl.run() Thank you
4

0 回答 0