If a majority of Members of Parliament vote yes on a no-confidence vote, that will trigger an election. Otherwise the prime minister chooses when an election will happen, within 5 years. If the government is a minority, it is likely it will call an election within a year or two if they're confident they could get a majority (this happened last year). Otherwise, with a majority government, they tend to wait longer before calling an election.