f4 = bimpy.Float(); f5 = bimpy.Float(); #slider_angle f6 = bimpy.Float(); #slider int2 i1 = bimpy.Int(); i2 = bimpy.Int(); while(not ctx.should_close()): ctx.new_frame() bimpy.begin("Sliders!", flags=bimpy.WindowFlags.AlwaysAutoResize) bimpy.slider_float3("float3", f1, f2, f3, 0.0, 1.0) bimpy.v_slider_float("v_slider", bimpy.Vec2(20, 300), f4, 0.0, 1.0) bimpy.same_line() bimpy.v_slider_float("v_slider2", bimpy.Vec2(50, 300), f5, -100.0, 100.0, "[%.1f]") bimpy.slider_angle("slider_angle", f6, -100.0, 100.0) bimpy.slider_int2("slider_int2", i1, i2, 0, 100) bimpy.end() ctx.render()
c = b.Context() c.init(1200, 1200, "bimpy test") img = Image.new( "RGBA", (512, 512), ) px = img.load() for x in range(512): for y in range(512): r = int(255.0 * float(x) / 512.0) g = int(255.0 * float(y) / 512.0) px[x, y] = (r, g, max(255 - r - g, 0), 255) b_img = b.Image(img) b_f1 = b.Float() b_f2 = b.Float() b_f3 = b.Float() while not c.should_close(): with c: b.text("hi") if b.button("cat"): print("mew") b.input_float("float1", b_f1, 0.0, 1.0) b.image(b_img) b.slider_float3("float", b_f1, b_f2, b_f3, 0.0, 1.0)
dirvecx, dirvecy, dirvecxnorm, dirvecynorm, dirvecmag, dirvecmagnorm = DrawHUD( image, width, height, headx, heady) im = bimpy.Image(image) bimpy.begin("Image") bimpy.image(im) bimpy.end() bimpy.begin("Analysis") bimpy.text("Hello, world!") f1.value = abs(dirvecxnorm) f2.value = abs(dirvecynorm) f3.value = abs(dirvecmag) bimpy.slider_float3("Face Vector", f1, f2, f3, 0.0, 1.0) bimpy.end() bimpy.begin("Console") bimpy.text("Image read:" + str(f1.value) + str(f2.value) + str(f3.value)) bimpy.text("Found {0} faces!".format(len(faces))) bimpy.text(facestr) bimpy.text("Direction vector:" + str(dirvecx) + ' ' + str(dirvecy) + ' ' + str(dirvecmag)) #for (x, y, w, h) in faces: #cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2) bimpy.end()