01/10/2018, 17:21

Hỏi về đường dẫn ảnh trong python

em dân mới vào nghề các bác chỉ giáo giúp ạ
Nếu như đoạn code như này:

class WhackAMole:
    NUM_MOLES_ACROSS = 4

    def __init__(self):
        self.window = tk.Tk()
        self.mole_frame, self.status_frame = self.create_frames()
        self.mole_photo = PhotoImage(file="mole.png")
        self.mole_buttons = self.create_moles()

thì các bác cho em hỏi cái file “mole.png” này nó phải lưu ở đâu trong máy tính ạ?

link chương trình full đây ạ: http://interactivepython.org/runestone/static/thinkcspy/_static/Programs/whack_a_mole_v2.py

Em cảm ơn

HK boy viết 19:37 ngày 01/10/2018

Để cùng với file .py của bạn.

Tìm hiểu relative path and absolute path

en.wikipedia.org

Path (computing)

A path, the general form of the name of a file or directory, specifies a unique location in a file system. A path points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used exten...

Bài liên quan
0