473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[SOLVED]Tkinter refreshing

3
First of all, I have to say that I'm rather newbie to Python, and I've got a problem with Tkinter. I'm writing a game (exactly photonic attack), and i want to have a simulation of a game computer vs computer:) the board is 8x8 square, and for each field I made a frame. In the game background of a frame is set on black or white depends on player. I want to push a button, and see how the computer is playing with himself. I've it almost done, but when I press the button, players makes their moves, but none of frames changes background until end of game, when the board shows the final result. The interesting (I think :) ) code:

Expand|Select|Wrap|Line Numbers
  1. def ente(number, a, use):
  2.     global remaining
  3.     global uklad
  4.     remaining=pozo(uklad)
  5.  
  6. #    while(pozostale!=[]):
  7.     if(pozostale!=[]):
  8.  
  9.         use=1-use
  10.         uklad=computer_play(uklad,ramining, use)
  11.     #    sleep(0.5)
  12.         whi=0
  13.         bla=0
  14.         for i in range(64):
  15.             if(uklad[i]==1):
  16.                 a[i]["background"]="white"
  17.                 whi+=1
  18.             elif(uklad[i]==2):
  19.                 a[i]["background"]="black"
  20.                 bla+=1
  21.  
  22.  
  23.         remaining=pozo(uklad)
  24.         ente(number, a, use)
  25.     else:
  26.         print "end of game"

where remaining is a list of possible plays, uklad is a list holding state of game, use - number of a player(0,1), computer_plays is a function, that evaluates the "best" of move adding it to state of game, and returns if, and finally the 'a' is a list of frames,

Hope you understood my problem:)


I'm a dumbass:) I've solved problem by looking to a book stored on my disk:) anyway thank everryone who looked at my post
Mar 4 '08 #1
0 838

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Russell E. Owen | last post by:
I want to support execution of simple user-written scripts in a Tkinter application. The scripts should be able to wait for data and such without hanging the GUI (and without having to write the...
6
by: max(01)* | last post by:
hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance...
6
by: Richard Lewis | last post by:
Hi there, I've got a tree control in Tkinter (using the ESRF Tree module) but I can't get it to layout how I want it. I'd like to have it so that it streches north/south (anchored to the top...
2
by: vm | last post by:
please help! I can't find anything wrong (except the result ofc ;-) This: picfile = 'logo.gif'
14
by: Hendrik van Rooyen | last post by:
Hi, I get the following: hvr@LINUXBOXMicrocorp:~/Controller/libpython display.py UpdateStringProc should not be invoked for type font Aborted and I am back at the bash prompt - this is...
2
by: jim-on-linux | last post by:
py help, The file below will run as a stand alone file. It works fine as it is. But, when I call it from another module it locks my computer, The off switch is the only salvation. This...
3
by: Thomas Ploch | last post by:
Hello folks, Since this is my first post on the list, a brief introduction of myself. My name is Thomas, I am 26 years old, I am a student of Computational Linguistics and I am a python...
7
by: krishnakant Mane | last post by:
hello all, I seam to have noticed this a bit late but it appears to me that tkinter is being used very widely for gui development on all platform? is that right? since fredric lundh has written a...
4
by: Davy | last post by:
Hi all, I have written a simple Tkinter program, that is draw a rectangle in a canvas, when I press Up key, the rectangle move up. But the program seems work not properly? My environment is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.