Open main menu

Gramps β

Changes

Nl:GRAMPS 3.1 Wiki Handleiding - Gramplets

1,528 bytes removed, 18:14, 8 June 2009
Python Gramplet
Dit voorbeeld geeft weer dat er een huwelijksgebeurtenis was (en dus een berekening van de periode), maar geen van beide partners had een overlijdensgebeurtenis. Zelfs indien u de overlijdensdatum niet kent, voegt u voor één van beide personen een overlijdensgebeurtenis in (zonder verdere gegevens) en de lijst zal gecorrigeerd worden. Hiervoor sluit u en opent u de Gramplet opnieuw en de aangepaste gegevens worden automatisch getoond.
== Python Gramplet ==
[[Image:Pythongadget.png|thumb|right|200px|Fig. 4.8 Python Shell]]
The Python gramplet brings up a Python Shell for interpreting python expressions.
 
You can type most any (single line) Python expression.
 
In addition, the environment has been populated with some useful variables, including '''self''' (this Python gramplet), '''Date''', '''uistate''' and '''dbstate'''.
 
Note that the name '''Date''' will be translated into your language, if a translations is available.
 
 
The '''Date''' entry is a date object constructor, and can be used for date arithmetic. For example, you might be interested in questions like:
 
What was the date 56 years before a given date:
 
> Date(2007, 12, 31) - 56
1951-12-31
 
How old was someone on Sept 3, 1955 who was born on June 7, 1922:
 
> Date(1955, 9, 3) - Date(1922, 5, 7)
(33, 3, 27)
 
(About 33 years, 3 months, and 27 days). When did they turn 21 years old?
 
> Date(1922, 5, 7) + 21
1943-05-07
 
You can also add years, months, and days:
 
> Date(1980) + (0, 0, 25)
1980-01-26
 
You can also use the same formats as you use in data entry:
 
> Date("Jan 15, 1962")
1962-15-01
> Date("15 Jan, 1962")
1962-15-01
> Date("1962-15-01")
1962-15-01
 
There are two ways to use different calendars:
 
> Date("Jan 15, 1532 (Julian)")
1532-15-01 (Julian)
> Date(1671, 12, 31, calendar="julian")
1671-12-31
 
and a method to convert one date into another calendar, which returns a new date object:
 
> Date(1703, 6, 1).to_calendar("hebrew")
5463-10-17 (Hebrew)
== News Gramplet ==
3,245
edits