My test code works but it doesn't when I paste it in my main












-1














I did some test aiming to display appropriated images on auto-generated buttons but when I copy/paste the code who works in my main code, this doesn't work and says "can't find pyimage1 (2,3,4..etc)"
The part that isn't working is the one in ItemOpen() and I just can't find why this isn't working.



This works :



import tkinter as tk
from PIL import Image, ImageTk

itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon)
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()


But this doesn't



import tkinter as tk
from PIL import Image, ImageTk

num = 0
item1 = ''
item2 = ''
item3 = ''
item4 = ''
item5 = ''
item6 = ''
item7 = ''

def EnablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.NORMAL)

def DisablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.DISABLED)

def ItemClose(name):
global num
EnablItem()
p = 1
slots = [slot1,slot2,slot3,slot4,slot5,slot6]
for slot in slots:
if (p == num):
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot.config(height=64,width=64,image = itempic)
slot.image = itempic
p = p + 1
items = [item1,item2,item3,item4,item5,item6]
m = 1
for item in items:
if (m == num):
item = name

def ItemOpen(n):
global num
num = n
DisablItem()
itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon,command = lambda x=a:ItemClose(x) & itemwindo.destroy())
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()

def PotionClose(name):
EnablItem()
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot7.config(height=64,width=64,image = itempic)
slot7.image = itempic
global item7
item7 = name

def PotionOpen():
DisablItem()
potionwindo = tk.Tk()
potionwindo.title("Potions")
potions = ['Wrath', 'Sorcery', 'Pilfered']
x = 0
for potion in potions:
nom = potion + '.png'
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(potionwindo,image = icon,command = lambda x = potion:PotionClose(x) & potionwindo.destroy())
bt.grid(column = x,row = 1)
bt.image = icon
x = x + 1
potionwindo.mainloop()



windo = tk.Tk()
windo.title("Damage Calculator")

slot1=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=1:ItemOpen(x))
slot2=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=2:ItemOpen(x))
slot3=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=3:ItemOpen(x))
slot4=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=4:ItemOpen(x))
slot5=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=5:ItemOpen(x))
slot6=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=6:ItemOpen(x))
slot7=tk.Button(windo,text="Potion",height=4,width=8,bg='gray64',relief=tk.SUNKEN,command = PotionOpen)

slot1.grid(column=0,row=0)
slot2.grid(column=1,row=0)
slot3.grid(column=2,row=0)
slot4.grid(column=3,row=0)
slot5.grid(column=4,row=0)
slot6.grid(column=5,row=0)
slot7.grid(column=6,row=0)

windo.mainloop()









share|improve this question







New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    BIG NO GO: Using tk.Tk() more than once!
    – stovfl
    Dec 27 at 14:42










  • Why ? I want to do sevral windows, is there another way ? It does work like this tho
    – Deltix
    Dec 27 at 14:52










  • "Why ?": It's invalid, you have to use Tkinter Toplevel Widget
    – stovfl
    Dec 27 at 14:55










  • Ok thanks, it solved my problem, idk how lmao but thx
    – Deltix
    Dec 27 at 15:09








  • 2




    You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
    – Mike - SMT
    Dec 27 at 15:23
















-1














I did some test aiming to display appropriated images on auto-generated buttons but when I copy/paste the code who works in my main code, this doesn't work and says "can't find pyimage1 (2,3,4..etc)"
The part that isn't working is the one in ItemOpen() and I just can't find why this isn't working.



This works :



import tkinter as tk
from PIL import Image, ImageTk

itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon)
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()


But this doesn't



import tkinter as tk
from PIL import Image, ImageTk

num = 0
item1 = ''
item2 = ''
item3 = ''
item4 = ''
item5 = ''
item6 = ''
item7 = ''

def EnablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.NORMAL)

def DisablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.DISABLED)

def ItemClose(name):
global num
EnablItem()
p = 1
slots = [slot1,slot2,slot3,slot4,slot5,slot6]
for slot in slots:
if (p == num):
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot.config(height=64,width=64,image = itempic)
slot.image = itempic
p = p + 1
items = [item1,item2,item3,item4,item5,item6]
m = 1
for item in items:
if (m == num):
item = name

def ItemOpen(n):
global num
num = n
DisablItem()
itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon,command = lambda x=a:ItemClose(x) & itemwindo.destroy())
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()

def PotionClose(name):
EnablItem()
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot7.config(height=64,width=64,image = itempic)
slot7.image = itempic
global item7
item7 = name

def PotionOpen():
DisablItem()
potionwindo = tk.Tk()
potionwindo.title("Potions")
potions = ['Wrath', 'Sorcery', 'Pilfered']
x = 0
for potion in potions:
nom = potion + '.png'
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(potionwindo,image = icon,command = lambda x = potion:PotionClose(x) & potionwindo.destroy())
bt.grid(column = x,row = 1)
bt.image = icon
x = x + 1
potionwindo.mainloop()



windo = tk.Tk()
windo.title("Damage Calculator")

slot1=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=1:ItemOpen(x))
slot2=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=2:ItemOpen(x))
slot3=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=3:ItemOpen(x))
slot4=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=4:ItemOpen(x))
slot5=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=5:ItemOpen(x))
slot6=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=6:ItemOpen(x))
slot7=tk.Button(windo,text="Potion",height=4,width=8,bg='gray64',relief=tk.SUNKEN,command = PotionOpen)

slot1.grid(column=0,row=0)
slot2.grid(column=1,row=0)
slot3.grid(column=2,row=0)
slot4.grid(column=3,row=0)
slot5.grid(column=4,row=0)
slot6.grid(column=5,row=0)
slot7.grid(column=6,row=0)

windo.mainloop()









share|improve this question







New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    BIG NO GO: Using tk.Tk() more than once!
    – stovfl
    Dec 27 at 14:42










  • Why ? I want to do sevral windows, is there another way ? It does work like this tho
    – Deltix
    Dec 27 at 14:52










  • "Why ?": It's invalid, you have to use Tkinter Toplevel Widget
    – stovfl
    Dec 27 at 14:55










  • Ok thanks, it solved my problem, idk how lmao but thx
    – Deltix
    Dec 27 at 15:09








  • 2




    You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
    – Mike - SMT
    Dec 27 at 15:23














-1












-1








-1







I did some test aiming to display appropriated images on auto-generated buttons but when I copy/paste the code who works in my main code, this doesn't work and says "can't find pyimage1 (2,3,4..etc)"
The part that isn't working is the one in ItemOpen() and I just can't find why this isn't working.



This works :



import tkinter as tk
from PIL import Image, ImageTk

itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon)
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()


But this doesn't



import tkinter as tk
from PIL import Image, ImageTk

num = 0
item1 = ''
item2 = ''
item3 = ''
item4 = ''
item5 = ''
item6 = ''
item7 = ''

def EnablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.NORMAL)

def DisablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.DISABLED)

def ItemClose(name):
global num
EnablItem()
p = 1
slots = [slot1,slot2,slot3,slot4,slot5,slot6]
for slot in slots:
if (p == num):
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot.config(height=64,width=64,image = itempic)
slot.image = itempic
p = p + 1
items = [item1,item2,item3,item4,item5,item6]
m = 1
for item in items:
if (m == num):
item = name

def ItemOpen(n):
global num
num = n
DisablItem()
itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon,command = lambda x=a:ItemClose(x) & itemwindo.destroy())
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()

def PotionClose(name):
EnablItem()
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot7.config(height=64,width=64,image = itempic)
slot7.image = itempic
global item7
item7 = name

def PotionOpen():
DisablItem()
potionwindo = tk.Tk()
potionwindo.title("Potions")
potions = ['Wrath', 'Sorcery', 'Pilfered']
x = 0
for potion in potions:
nom = potion + '.png'
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(potionwindo,image = icon,command = lambda x = potion:PotionClose(x) & potionwindo.destroy())
bt.grid(column = x,row = 1)
bt.image = icon
x = x + 1
potionwindo.mainloop()



windo = tk.Tk()
windo.title("Damage Calculator")

slot1=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=1:ItemOpen(x))
slot2=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=2:ItemOpen(x))
slot3=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=3:ItemOpen(x))
slot4=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=4:ItemOpen(x))
slot5=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=5:ItemOpen(x))
slot6=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=6:ItemOpen(x))
slot7=tk.Button(windo,text="Potion",height=4,width=8,bg='gray64',relief=tk.SUNKEN,command = PotionOpen)

slot1.grid(column=0,row=0)
slot2.grid(column=1,row=0)
slot3.grid(column=2,row=0)
slot4.grid(column=3,row=0)
slot5.grid(column=4,row=0)
slot6.grid(column=5,row=0)
slot7.grid(column=6,row=0)

windo.mainloop()









share|improve this question







New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I did some test aiming to display appropriated images on auto-generated buttons but when I copy/paste the code who works in my main code, this doesn't work and says "can't find pyimage1 (2,3,4..etc)"
The part that isn't working is the one in ItemOpen() and I just can't find why this isn't working.



This works :



import tkinter as tk
from PIL import Image, ImageTk

itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon)
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()


But this doesn't



import tkinter as tk
from PIL import Image, ImageTk

num = 0
item1 = ''
item2 = ''
item3 = ''
item4 = ''
item5 = ''
item6 = ''
item7 = ''

def EnablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.NORMAL)

def DisablItem():
slots = [slot1,slot2,slot3,slot4,slot5,slot6,slot7]
for slot in slots:
slot.config(state=tk.DISABLED)

def ItemClose(name):
global num
EnablItem()
p = 1
slots = [slot1,slot2,slot3,slot4,slot5,slot6]
for slot in slots:
if (p == num):
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot.config(height=64,width=64,image = itempic)
slot.image = itempic
p = p + 1
items = [item1,item2,item3,item4,item5,item6]
m = 1
for item in items:
if (m == num):
item = name

def ItemOpen(n):
global num
num = n
DisablItem()
itemwindo = tk.Tk()
itemwindo.title("Items")
data = open("Ressource.txt","r")
x = 0
y = 0
nomimg =
for line in data:
if 'Vi' in line:
(a,b,c,d,e) = line.split("/")
nom = a + '.png'
nomimg.append(nom)
for nom in nomimg:
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(itemwindo,image = icon,command = lambda x=a:ItemClose(x) & itemwindo.destroy())
bt.grid(column = x,row = y)
bt.image = icon
if (x>6):
x = 0
y = y + 1
else:
x = x + 1
itemwindo.mainloop()

def PotionClose(name):
EnablItem()
name = name + '.png'
itempic = ImageTk.PhotoImage(Image.open(name))
slot7.config(height=64,width=64,image = itempic)
slot7.image = itempic
global item7
item7 = name

def PotionOpen():
DisablItem()
potionwindo = tk.Tk()
potionwindo.title("Potions")
potions = ['Wrath', 'Sorcery', 'Pilfered']
x = 0
for potion in potions:
nom = potion + '.png'
icon = ImageTk.PhotoImage(Image.open(nom))
bt = tk.Button(potionwindo,image = icon,command = lambda x = potion:PotionClose(x) & potionwindo.destroy())
bt.grid(column = x,row = 1)
bt.image = icon
x = x + 1
potionwindo.mainloop()



windo = tk.Tk()
windo.title("Damage Calculator")

slot1=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=1:ItemOpen(x))
slot2=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=2:ItemOpen(x))
slot3=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=3:ItemOpen(x))
slot4=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=4:ItemOpen(x))
slot5=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=5:ItemOpen(x))
slot6=tk.Button(windo,height=4,width=8,bg='azure3',relief=tk.SUNKEN,command = lambda x=6:ItemOpen(x))
slot7=tk.Button(windo,text="Potion",height=4,width=8,bg='gray64',relief=tk.SUNKEN,command = PotionOpen)

slot1.grid(column=0,row=0)
slot2.grid(column=1,row=0)
slot3.grid(column=2,row=0)
slot4.grid(column=3,row=0)
slot5.grid(column=4,row=0)
slot6.grid(column=5,row=0)
slot7.grid(column=6,row=0)

windo.mainloop()






python tkinter python-imaging-library






share|improve this question







New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 27 at 14:32









Deltix

91




91




New contributor




Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Deltix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    BIG NO GO: Using tk.Tk() more than once!
    – stovfl
    Dec 27 at 14:42










  • Why ? I want to do sevral windows, is there another way ? It does work like this tho
    – Deltix
    Dec 27 at 14:52










  • "Why ?": It's invalid, you have to use Tkinter Toplevel Widget
    – stovfl
    Dec 27 at 14:55










  • Ok thanks, it solved my problem, idk how lmao but thx
    – Deltix
    Dec 27 at 15:09








  • 2




    You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
    – Mike - SMT
    Dec 27 at 15:23














  • 1




    BIG NO GO: Using tk.Tk() more than once!
    – stovfl
    Dec 27 at 14:42










  • Why ? I want to do sevral windows, is there another way ? It does work like this tho
    – Deltix
    Dec 27 at 14:52










  • "Why ?": It's invalid, you have to use Tkinter Toplevel Widget
    – stovfl
    Dec 27 at 14:55










  • Ok thanks, it solved my problem, idk how lmao but thx
    – Deltix
    Dec 27 at 15:09








  • 2




    You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
    – Mike - SMT
    Dec 27 at 15:23








1




1




BIG NO GO: Using tk.Tk() more than once!
– stovfl
Dec 27 at 14:42




BIG NO GO: Using tk.Tk() more than once!
– stovfl
Dec 27 at 14:42












Why ? I want to do sevral windows, is there another way ? It does work like this tho
– Deltix
Dec 27 at 14:52




Why ? I want to do sevral windows, is there another way ? It does work like this tho
– Deltix
Dec 27 at 14:52












"Why ?": It's invalid, you have to use Tkinter Toplevel Widget
– stovfl
Dec 27 at 14:55




"Why ?": It's invalid, you have to use Tkinter Toplevel Widget
– stovfl
Dec 27 at 14:55












Ok thanks, it solved my problem, idk how lmao but thx
– Deltix
Dec 27 at 15:09






Ok thanks, it solved my problem, idk how lmao but thx
– Deltix
Dec 27 at 15:09






2




2




You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
– Mike - SMT
Dec 27 at 15:23




You should only ever have one instance of Tk() in your code. This is the main tkinter window and for any other windows you want to open outside of the main window you will need to use the Toplevel() class. This will let you open as many windows as you need within that instance of Tk().
– Mike - SMT
Dec 27 at 15:23

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Deltix is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53946678%2fmy-test-code-works-but-it-doesnt-when-i-paste-it-in-my-main%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Deltix is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Deltix is a new contributor. Be nice, and check out our Code of Conduct.













Deltix is a new contributor. Be nice, and check out our Code of Conduct.












Deltix is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53946678%2fmy-test-code-works-but-it-doesnt-when-i-paste-it-in-my-main%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas