Python Forum
[xbmc] How to block the code from executed twice under the loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[xbmc] How to block the code from executed twice under the loop
#25
(Oct-25-2016, 07:34 PM)metulburr Wrote:
(Oct-25-2016, 07:18 PM)chris0147 Wrote: I'm sorry that my coding and explaition are terrible, but I am trying my best all I can do to get you to understand what I am trying to do.
For future reference when we ask what library you are using you could respond with something like...

i dont know but there is an import line like this at the top
import xbmc
import xbmcgui
as well as what you were working on to give us a better understanding such as the github repo link

Quote:If you want to take a look on my code to know what I am doing, here it is: http://pastebin.com/TZ24Bn0Y
Your code although sometimes useful to have the entire thing.....this one gives me a headache to look at. I dont even know where to start.

The version for xbmc is 12.2 and gui version is 4.0.0.

I don't think there is anything have to do with gui version, it is just the code that I am working on which it dont seen right.

I guess that I am stuck with storing the program ids in the list.


    test_id = list()

    #Store the list of strings in the lists
        for i in range(len(posX)):
            pos_X = posX[i]

            if pos_X == '375':
                self.program_id = list()
                self.program_id.append(programs_id[i])

    for program_id in self.program_id:
        test_id_list = list()
        test_id_list.append(program_id)

    print "test_id"
    print test_id
    
   program_id = ''.join(str(x) for x in test_id_list)
Do you know how I can store each id at a time and make the output like this?


Quote:['3001']
['3011']
['3021']
['3031']
['3041']
['3051']
['3061']


instead of this?

Quote:['3001', '3011', '3021', '3031', '3041', '3051', '3061']



I want to store one id in the list at a time and find the control that I want to use to change the size before I could empty the list and store the next id then find the control that I want to use to change the size I want. It can repeats until there is no more id when I'm searching for the id in the pos_X area.

I think it is only way to do this to avoid the looping otherwise it will looping and the code will executing like three times. If I use the single id, I don't think I would have any problem as I would be able to have the code to execute only once when I use for each id.

Can you be able to help me with that?
Reply


Messages In This Thread
RE: How to block the code from executed twice under the loop - by chris0147 - Oct-25-2016, 10:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] messagebox is not being executed please help erwinsiuda 2 2,329 Apr-02-2020, 01:56 AM
Last Post: Larz60+
  [Tkinter] Window unresponsive when executed. fawazcode 2 3,829 Sep-11-2017, 12:29 AM
Last Post: Larz60+
  [WxPython] Which def is executed? merlem 10 7,920 Feb-10-2017, 11:28 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020