There are a few reasons for the apparent rush for cannons over trebuchets:
The early cannons were very much an icon of status for many, so despite the ineffiency of guns at first, they very much sought after.
Trebuchets were contary to what people think, are short-ranged - about 200 yards range. Gunpowder artillery, despite the inaccuracy, had a much greater range.
Because people were just being introduced to the new gunpowder artillery, most people were a lot more fearful of these beasts, than the more common trebuchets and catapults.
Bombards, and then cannons were far more effective against the old walls - which were built with ballistic weapons in mind.
Trebuchets were last used around the early 16th century by the Spanish in South America - but only because they ran out of powder.
Blackadder: Baldrick, have you no idea what irony is?
Baldrick: Yes, it's like goldy and bronzy only it's made out of iron.