![]() And starting a simple HTTP server in Python is a one-liner, if you utilize the SimpleHTTPServer package. Obviously, a table is (a) a very well-supported 2D grid layout in HTML and (b) perfect for square gameboards with cells. So you could craft an alternate plan: Have your python program launch a very simple HTTP server, then serve up your graphical representation of the game board in HTML, e.g., as an HTML table. We're all for re-use when we can, and one of the simplest yet best developed GUI environments of all is the modern web browser. tkinter is a pretty slick and fast package! Option: Stand on the shoulders of giants. And I discovered that's it's a piece of cake to actually do cool interactive GUI stuff like allow you to move pieces by clicking. For instance, the image at the right is a nifty basic Halma board I whipped up in a couple of hours, starting from knowing zero about tkinter, just to mess around with what can be done and how it might look. But tkinter would get the job done for sure. If you wanted to upgrade to a bit more sophistication, you could look at GTK+ or one of the other GUI toolkits for Python. The GUIs that you make with tkinter are not particularly 's a fairly quick and dirty approach. This a nice compact tkinter reference that I found useful. Here's a nice little sample GUI article there are a bazillion other tutorials too. This allows you to open windows, define layouts, and populate them with widgets. Python also has its built-in basic GUI package called Tkinter. Swing is directly based on TK you might even consider it a Java wrapper for TK. If you've programming in Java, then you might be familiar with Swing, which is Java's built-in GUI framework. buttons that actually work), you then wire these GUI elements to code, essentially implementing their stubbed "on click" method, for instance. ![]() ![]() Of course it has been developed extensively since then, but the basics remain: a simple way to render various standard GUI "widgets", like buttons, scroll bars, etc., plus a layout framework for placing them on the screen. One of the earliest and best developed of these was TK, which has been around since the late 80's, the very start of GUI history. Nearly every language has some basic GUI layout framework included. Here are a couple of options: Option: Use a basic GUI layout framework. You could invest tons of time and make these look at a nice and pretty as any GUI you've ever seen.but in many cases, we'll just want to get something up that looks halfway decent and does the job. For many Python projects, however, what you need is just a very simple way to display some information, e.g., a Boggle board, a Battleship board, or other boardgame board. Python Graphics quickstart Python Graphics QuickstartĪs you might expect, there are TONS of ways to do graphics in Python there are ports that make accessible about every sort of graphics framework ever available. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |