Fr Widget Basics

This chapter teaches you the basics of Fr_Widget toolkit

Writing your first Fr_Widget program
Basically, you need always to have a Fr_CoinWindow. This widget is the container of the other widgets you create. It is a subclass of Fr_Group. The Fr_CoinWindow used to distribute events and hold a link to each widget you have in your window. Fr_CoinWindow doesn't draw any thing and it is not restricted to any dimensions. But there must be a such windows for getting your Fr_Widgets work. If FreeCAD adapt this toolkit someday, the Fr_CoinWindow should be always available and you shouldn't required to create one. But at the moment, you have to create one Fr_CoinWindow whenever you need to use the toolkit. Notice that you shouldn't make several of this widget .. Only one.

The widgets interact with the user using the callback system.

import ThreeDWidgets.fr_arrow_widget as wd import ThreeDWidgets.fr_coinwindow as wnn import math

mywin = wnn.Fr_CoinWindow rotation=0 vec=App.Vector(0,0,0) arrows=(wd.Fr_Arrow_Widget(vec)) rotation=([0.0,0.0,1.0,math.radians(45)])  #TODO:This will be changed to degree. Internally is radians arrows.w_color=(10,40,10) arrows.setRotationAngle(rotation) mywin.addWidget(arrows) mywin.show