Hi I was wondering if there is a way to create a maze type interface (a very simple one), as I am making a game which involves a pacman type feel but at a smaller and simpler scale. I want to do so using python tkinter. Thank You. I was hoping to use a grid to do so.
Share
As g.d.d.c pointed out,
TkIntermay not be the best API for this.TkInteris designed to make it easy to create interfaces out of traditional GUI widgets—buttons, checkboxes, option menus, etc. And the same is true for other GUI frameworks likeQtandwx. While you might be able to abuse a grid layout or spreadsheet widget by drawing custom borders or something like that in some frameworks, you probably don’t want to. (For example, in TkInter, I believe using aGridgeometry manager would, with a lot of work, allow you to make something that works on, e.g., your linux box, but looks like garbage for anyone on Windows, on Mac, or even on linux/X with a different default theme than you. I assume that’s not what you want.)That being said, drawing a 2D maze is pretty simple. All you have to do is create a
canvas, and draw on it withcreate_lineand similar commands. If you want to keep track of the player’s current position, you can do that yourself, and draw a sprite with, e.g.,create_bitmap. And so on.