Fill tree with histograms in PyROOT

I want to fill a tree with histograms in PyROOT.
Something like (in c++):

TFile f("f.root", "recreate");
TTree t("t", "t");
TH1F h("h", "h", 10, 0, 1);
t.Branch("h", &h);
h.Fill(0.5);
t.Fill();
t.Write();
f.Close();

Can someone help me?

Never mind, I found the thread that answers this question.
[Filling TTree in Python with PyROOT