![]() Self.render_image_locked() # Render the image after the button is lockedĬheck_img = ('check.jpg').convert_alpha() # The tick in the upper right corner after the button is locked So we can inherit the KeyboardButton class from the previous article to write the buttons in our Checkbox. The difference is that after clicking, the button will be locked with a tick. Pygame widgets: keyboard simulation-virtual keyboard (Keyboard)Ĭheckboxes can be used in many places in the game, such as selecting characters at the beginning of the game, teaming up, selecting multiple items, etc., don't talk nonsense, and show the code below.Įach item in the check box can be regarded as a button. ![]() The article reuses some of the classes and methods in the previous article This article mainly describes how to implement checkboxes with pygame. Staying at home and indulging in pygame programming, this article will share with you some simple small functions based on pygame, which can be well embedded in the game to increase the interactivity of the game.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |