|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
problems with tkinter, are while loops possible?
im making a very simple game where right now the controllable character is a rectangle on a canvas. i bound function for the movement to the arrow keys, and the rectangle is moved by canvas.move()
my problem is that i want the arrow keys to simple change the direction of the movement and have the rectangle always move in that direction without key presses. so i tried a while loop which seemed like the natural solution, but the problem is the entire loop has to be executed before the window is created and while 1: loops make it freeze. is there any solution to this? |
|
#2
|
||||
|
||||
|
while loops are possable in GUI's
, that i do know! I guess what you should be doing is calling your 'move this way' function inside your while loop.. if you have some code i'll take a look ![]() Oh, in Python 2.3+ you should use the True keyword instead of 1 (as long as you arnt bothered about back compatability), so your while loop should look like this.. while True: ... do whatever ... Also, if you want to make games with Python can i suggest you try Pygame, its allot more powerful and this is what it was built for! http://www.pygame.org/ Mark. |
|
#3
|
|||
|
|||
|
i know of pygame, i learned a bit and to be honest i dont like it a lot. for this simple game i know i can avoid it. heres thing the thing, there is no while loop. in tkinter, the only way i know of making things work is in events, and i tried puting a while loop in an event but again its as if the loop finishes in one go and and then everything is displayed, its in explicable. does anyone ahve any experience with this?
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > problems with tkinter, are while loops possible? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|