Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

I'm trying to make it so that if I write Luffy it will open a picture of Luffy and if I write Zoro picture Zoro

+7 votes
asked Oct 21 by MegaSnake (190 points)
from tkinter import *
text = input("one piece\n: ")
luffy = 'luffy'
zoro = 'zoro'
if text == luffy:
 window = Tk()
 window.title('luffy')
 window = Canvas(window,width= 400, height = 400)
 window.pack()
 image = PhotoImage(file = 'D:\down\luffy.PNG')
 window.create_image(0,0, anchor = NW, image = image)

 window.mainloop()

if text == zoro:
 windows = Tk()
 windows.title('zoro')
 windows = Canvas(windows,width= 500, height = 500)
 windows.pack()
 images = PhotoImage(file = 'D:\down\zoro.png')
 windows.create_image(0,0, anchor = NW, images = images)
 windows.mainloop()

1 Answer

+1 vote
answered Oct 26 by Peter Minarik (63,140 points)
Online GDB does not have support for graphics, only console output.

You'll need to install Python on your own computer to make this work.

https://www.python.org/downloads/
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...