I would like to be able to add my own custom data/properties to existing folders on NTFS, so that if a folder is moved, the properties move with it. One solution would be to store a file within the folder to contain whatever I need or want.
What I am particularly interested in, is whether or not there is a way to add custom properties to the directory file system object itself.
If you are feeling brave (or foolish) perhaps an Alternative Data Stream would be an alternative.
I am not sure if can be applied to a directory as opposed to a normal file and it's littered with concerns that need to be considered:
There are no standard windows user tool that lists them (e.g. can't view from explorer or cmd prompt, but can be opened in most programs given correct name).
They will not transfer off of the NTFS filesystem well.
They may also raise some AV flags, I do not know.
Happy coding.
Here is a way in c# to show file custom properties
DSOFile.OleDocumentPropertiesClass file = new DSOFile.OleDocumentPropertiesClass();
file.Open(#"C:\setup.exe", false, DSOFile.dsoFileOpenOptions.dsoOptionDefault);
string key = "key1";
object value = "value1";
// Adds new custom property.
file.CustomProperties.Add(key, ref value);
// Go through existing custom properties.
foreach (DSOFile.CustomProperty p in file.CustomProperties)
{
Console.WriteLine("{0}:{1}", p.Name, p.get_Value().ToString());
}
file.Close(true);
First in file.CustomProperties.Add(key, ref value);
by modifying the attribute key(the property, you can modify it, here are the following.
in key you should put one of the following attribute_names, that are here described as constants by names from their real values
Const FILE_ATTRIBUTE_READONLY = 1
Const FILE_ATTRIBUTE_HIDDEN = 2
Const FILE_ATTRIBUTE_SYSTEM = 4
Const FILE_ATTRIBUTE_DIRECTORY = &H10
Const FILE_ATTRIBUTE_ARCHIVE = &H20
Const FILE_ATTRIBUTE_ENCRYPTED = &H40
Const FILE_ATTRIBUTE_NORMAL = &H80
Const FILE_ATTRIBUTE_TEMPORARY = &H100
Const FILE_ATTRIBUTE_SPARSE_FILE = &H200
Const FILE_ATTRIBUTE_REPARSE_POINT = &H400
Const FILE_ATTRIBUTE_COMPRESSED = &H800
Const FILE_ATTRIBUTE_OFFLINE = &H1000
Const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = &H2000
Then you should assign the desired value to the constant, in value
Then to see each properties of each file it show them on the line
Console.WriteLine("{0}:{1}", p.Name, p.get_Value().ToString());
Related
I have been bashing my head about this and can't seem to figure it out. In another engine, I could make a struct, then make an array of that struct that I could then edit in the inspector. There seems to be no way of doing this that I can find in Godot.
I want to have a Resource that holds the starting Value and Type of multiple faces on a dice. For example, one side could have "2 Damage" while another has "Heal 3." (this is a first-time godot experiment inspired by Slice&Dice). Every tutorial I watch however makes it seem like, if I want to do so, I'd have to make a completely new Resource for each combination of Value and Type (Damage 1 Resource, Damage 2 Resource, etc.)
class_name DiceResource extends Resource
class DiceFaceData:
export var BaseValue = 0
export(Resource) var Type = preload("Resources/DiceFaceTypes/Damage.tres")
func _init():
Type = 2
BaseValue = preload("Resources/DiceFaceTypes/Damage.tres")
export(Array) var Faces = [DiceFaceData.new()]
I cannot get DiceFaceData to show up in the Inspector's array, or be on the list of object types for an array. Extending Object doesn't work. Extending Node means I have to instantiate it, which I don't want to do for an editor-only Resource.
I find it hard to imagine Godot doesn't have anything like this available. Is there anything I can load in the inspector as just data and not have to instantiate it? Another option is create two arrays, one with int and another Resource, but that seems inconvenient to fill out. Or should I just give up with Resources and make everything a Node attached to a Node attached to a Node? Thanks!
Godot version 3.4.3
EDIT: If you're someone coming from Unity or Unreal, what you're looking for is Resource. While compared to ScriptableObjects or DataAssets from those other engines, that's not the complete answer. You would think, because of the way those game engines handle it, you can only create custom SO or DA as assets in the filesystem/content browser, but you can also use Resources as instanced classes. Instead of creating a new Resource in the filesystem, you can use
export(Resource) var n = preload("res://MyResourceScript.gd").new()
In the inspector, you can choose from the list New MyResourceScript and create it. You won't be referencing an externally made Reference file, you'll be creating a custom one right there. And look at the below answer as well on good tips for using Resources in cool ways.
First of all, I want to say that I sympathize. Custom resources and the inspector do not work well. There is a solution on the work… However that does not mean that the only thing we can do is keep Waiting For Godot.
Observations on your code
About your code, I want to point out that DiceFaceData is not a resource type. You could write it like this:
class DiceFaceData extends Resource:
export var BaseValue = 0
export(Resource) var Type = preload("Resources/DiceFaceTypes/Damage.tres")
func _init():
Type = 2
BaseValue = preload("Resources/DiceFaceTypes/Damage.tres")
And… That solves nothing.
And, also, by the way, I remind you can put it on its own file:
class_name DiceFaceData
extends Resource:
export var BaseValue = 0
export(Resource) var Type = preload("Resources/DiceFaceTypes/Damage.tres")
func _init():
Type = 2
BaseValue = preload("Resources/DiceFaceTypes/Damage.tres")
And… That is not the solution either.
Something else I want to point out is that GDScript has types. See Static typing in GDScript. Use them. To illustrate…
This is a Variant with an ìnt value
var BaseValue = 0
This is an int, typed explicitly:
var BaseValue:int = 0
And this is an int, typed implicitly with type inference:
var BaseValue := 0
And if you were using types Godot would tell you that this is an error:
BaseValue = preload("Resources/DiceFaceTypes/Damage.tres")
Because BaseValue is an int, and you setting a resource to it.
The Array of Resources problem
First of all, this is a Variant that happens to have an Array value, and it is exported as an Array:
export(Array) var Faces = []
Let us type it as an Array:
export(Array) var Faces := []
And sadly we cannot specify the type of the elements of the arrays in Godot 3.x (we need Godot 4.0 for that feature). However we can specify how we export it.
So, this is an Array exported as an Array of Resource:
export(Array, Resource) var Faces := []
See Exporting arrays.
Before you could not get your custom resource type to show up. And now you have the opposite problem: all the resource types show up. And this includes your custom resource type, if it in its own file.
You would guess that we need to specify the resource type we want:
export(Array, DiceFaceData) var Faces = []
And that would be correct if it were a build-in resource type. But it is a custom one. We are expecting this to be fixed in a future version. Meanwhile we will have to leave it with export(Array, Resource).
Mitigating the problem with an addon
To alleviate the pain of having all the possible resource types, consider using the addon "Improved resource picker" by MakovWait. You can find it on itch, or on github.
A proper solution
Anyway, we can do better. But you are going to need to make your script a tool script (you do that by putting tool on the top of the script, and it means that the code from the script can and will run on the editor).
We are going to define a setter with setget, and in there we are going to make sure the elements are of the correct type:
export(Array, Resource) var Faces = [] setget set_faces
func set_faces(new_value:Array) -> void:
Faces = []
for element in new_value:
element = element as DiceFaceData
if element == null:
element = DiceFaceData.new()
Faces.append(element)
Now, in the inspector panel when you increase the size of the array, Godot will insert a new null element to the array, which makes the setter we defined run, which will find that null and convert it to a new instance of your custom resource type, so you don't have to pick the resource type in the inspector panel at all.
A "hacky" solution
As you know, this does not work:
export(Array, DiceFaceData) var Faces = []
However, we can replace an export with _get_property_list. What happens is that Godot asks the object what properties it has to show up in the inspector panel. Godot does this by calling get_property_list And it will statically report the ones it found while parsing (the ones with export). However, Godot also defines a function _get_property_list where we can add more at run time.
See also Advanced exports.
Which begs the question, could we possibly make it work with _get_property_list? Kind of. The The code like this:
var Faces := []
func _get_property_list() -> Array:
return [
{
name = "Faces",
type = TYPE_ARRAY,
hint = 24,
hint_string = "17/17:DiceFaceData"
}
]
It will show up on the inspector as an array where the elements can only be of your custom resource type.
The issue is that it causes some error spam. Which you might or might not be OK with. It is your project, so it is up to you.
I know it looks like voodoo magic in part because we are using some undocumented stuff. If you want an explanation of that 24 and that 17/17: see How to add Array with hint and hint_string?.
About the sub-resources
Every tutorial I watch however makes it seem like, if I want to do so, I'd have to make a completely new Resource for each combination of Value and Type (Damage 1 Resource, Damage 2 Resource, etc.)
I'm not sure what you are getting to with "a completely new Resource", but yes. A resource is an instance of a resource type. And each of those combination would be a resource.
Perhaps "Damage", "Heal" and so on are resources too. Let us see… I'm guessing that is what the Type is for:
export(Resource) var Type = preload("Resources/DiceFaceTypes/Damage.tres")
Godot would be showing all the resource types it is aware of, which is a pain. I'm going to suggest a different approach than those above for this: Make an String enumeration.
export(String, "Damage", "Heal") var Type:String
That will show up as a drop down list on the inspector panel, with the options you specified.
Why String and not int? Ah, because you can then do this if you so desire:
var type_resource := load("Resources/DiceFaceTypes/" + Type + ".tres")
I'm assuming that those have the code that actually does damage or heal or whatever.
Alright, but when you add a new type of dice face, you would have to come here and update it… Or do you? With the power of tool scripts we are going to update that list to reflect the files that actually exist!
First of all, we are not going to use export, so it will be just:
var Type:String
And now we can export it from _get_property_list. There we can query the files. But before we do that, so we are clear what we have to do, the following code is equivalent to the export we had before:
func _get_property_list() -> Array:
return [
{
name = "Type",
type = TYPE_STRING,
hint = PROPERTY_HINT_ENUM,
hint_string = "Damage,Heal"
}
]
No undocumented stuff here.
Our task is to build that hint_string with the names of the files. And that looks like this:
const path := "res://"
func _get_property_list() -> Array:
var hint_string := ""
var directory := Directory.new()
if OK != directory.open(path) or OK != directory.list_dir_begin(true):
push_error("Unable to read path: " + path)
return []
var file_name := directory.get_next()
while file_name != "":
if not directory.current_is_dir() and file_name.get_extension() == "tres":
if hint_string != "":
hint_string += ","
hint_string += file_name
file_name = directory.get_next()
directory.list_dir_end()
return [
{
name = "Type",
type = TYPE_STRING,
hint = PROPERTY_HINT_ENUM,
hint_string = hint_string
}
]
Ah, yes, set the path constant to the path of the folder where the resources types you have are.
Addendum post edit
I want to elaborate on this example:
export(Resource) var n = preload("res://MyResourceScript.gd").new()
Here we are exporting a variable n as a Resource, which will appear in the Inspector panel. The variable is currently a Variant, we could type it Resource:
export(Resource) var n:Resource = preload("res://MyResourceScript.gd").new()
And then we don't need to tell Godot to export it as a Resource, because it is a Resource:
export var n:Resource = preload("res://MyResourceScript.gd").new()
Something else we can do is preload into a const. To be clear, preloads are resolved at parse time. Like this:
const MyResourceScript := preload("res://MyResourceScript.gd")
export var n:Resource = MyResourceScript.new()
This way, if you need to use the same script in multiple places, you don't need to repeat the path.
However, you might not need the path at all. If in the script res://MyResourceScript.gd we add a class_name (at the top of the script):
class_name MyResourceScript
Then we don't need to use preload at all. That name will be available everywhere, and you can just use it:
export var n:Resource = MyResourceScript.new()
Where is that resource stored?
Potentially nowhere. Above we are telling Godot to create a new one when our it initializes our object (e.g. which could be a Node, or another Resource - because, yes, Resources can have Resources) and those would only exist in RAM.
However, if you modify the Resource from the Inspector panel, Godot needs to store those changes somewhere. Now, if you are editing a Node, by default they go to the scene file. If you are editing another Resource, then it goes to wherever that Resource is stored. To be clear, scenes are resources too (PackedScene). And, yes, that means a file can have multiple Resources (A main resurce and sub-resources). You could also tell Godot to store the Resource in its own file from the Inspector panel. The advantage of giving a file to a Resource is in reusing it in multiple places (multiple scenes, for example).
So, a Resource could be stored in a file, or not stored at all. And a resource file could have a Resource alone, or it could also have sub-resources as well.
I'll take a moment to remind you that scenes can have instances of other scenes inside. So, there is no line between scenes and the so called "prefabs" in Godot.
… Did you know?
You can save the resources you created in runtime, using ResourceSaver. Which could be a way to save player progress, for example. You can also load them using load or ResourceLoader (in fact, load is a shorthand for ResourceLoader.load).
In fact, if you can use load or preload on something, it is a Resource. Wait a minute, we did this above:
const MyResourceScript := preload("res://MyResourceScript.gd")
Yep. The Script is a Resource. And yes, you can create that kind of resources in runtime too. Create a GDScript object (GDScript.new()), set its source_code, and reload it. Then you can attach it to an Object (e.g. a Node) with set_script. You can now start thinking of meta-programming, or modding support.
I'm updating large quantities of data using a script. I have to use arrays since .getValue and .setValue is very inefficient. My problem is that the data I am handling is containing checkboxes but when I use an array to copy and paste the data, the checkboxes are turned into TRUE and FALSE strings.
Is there any way to keep the checkbox object when using arrays to copy data ? Using .insertCheckboxes on individual cells is also very slow (and I cannot use .getRange().insertCheckboxes since the cells that contain checkboxes are not always adjacent).
If the source data is in a spreadsheet range, use Range.copyTo() with the appropriate CopyPasteType.
If you cannot use Range.copyTo() for some reason, you can copy values and validations with something like this:
function copyFromSheet1ToSheet2() {
const ss = SpreadsheetApp.getActive();
const source = ss.getRange('Sheet1!A1:D10');
const target = ss.getRange('Sheet2!A1');
copyValuesAndValidations(source, target);
}
function copyValuesAndValidations(sourceRange, targetRange) {
targetRange = targetRange.offset(0, 0, sourceRange.getHeight(), sourceRange.getWidth());
targetRange.setValues(sourceRange.getValues());
targetRange.setDataValidations(sourceRange.getDataValidations());
}
I am currently migrating our cloud infrastructure over to Terraform; it's all gone well so far. Right now, though, I am trying to set up the SQL Server app, and the current setup, which I need to mirror to migrate, takes the existing resource group Object ID and appends it onto a unique string, for example, sqldatabase23456-resource group object id.
In arm this is done the following way:
"sqlServerAdministratorUsername": "[concat('l', uniqueString(resourceGroup().id))]",
Except I am making the resource group in Terraform, so the variable needs to use the meta argument depends on as the variable value can not exist before the resource group exists. I don't think this is possible when reading the depends on the material from Terraform; it only seems to work for resources, not other items. Link to document: https://www.terraform.io/docs/language/meta-arguments/depends_on.html
I have seen it slightly discussed on here:
Terraform, can a resource be passed as a variable into a module?
I am happy to build this SQL server as a module. I need this to work this way; otherwise, we won't migrate over to Terraform. As we can't change the current setup with SQL, too much depends on it.
I need to pass the values into the login part of SQL server code example below:
resource "azurerm_mssql_server" "example" {
name = "mssqlserver"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
version = "12.0"
administrator_login = var.resourcegroup_withuniquestring
administrator_login_password = var.resourcegroup_withuniquestring_password
minimum_tls_version = "1.2"
tags = {
environment = "production"
}
}
I don't really know what do you mean by variable in this context.
Terraform has locals. Locals can reference other Terraform resources, by this making the dependency implicit, so there is no need for depends_on. Example:
resource "random_string" "random" {
length = 16
special = true
override_special = "/#£$"
}
locals {
sql_server_administrator_name = join("", "sqldatabase", random_string.random.result, "-", azurerm_resource_group.example.name,
}
Locals can be referenced in other resources:
resource "azurerm_mssql_server" "example" {
name = "mssqlserver"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
version = "12.0"
administrator_login = local.sql_server_administrator_name
administrator_login_password = local.password
minimum_tls_version = "1.2"
}
I actually figured this out using the prompting of Ervins anwser.
I used locals to put the resource group id as a variable but the problem with that is it will output a huge string that can not be used for account names, so here is the following steps that I took, to trim it down and make it usable.
I first made three local variables one to trim down the string and get the ID number of the resource group and disregard everything else.
Another to output the whole string so I could work out the string value and how many characters to count in.
And a Third to put both the unique string and the Resource Group ID number on the end.
Below is the code to trim the string.
resource_group_id = substr(("${azurerm_resource_group.Example_Terraform_Testing.id}"),15,36)
This is using the function substr in Terraform which allows you to chop up strings, as most of the functions will only let you work with maps, or lists.
Link to substr: https://www.terraform.io/docs/language/functions/substr.html
To work out the exact number I first used format as a local value then outputed the value through an output variable like this:
resource_group_id_full_value = format("${azurerm_resource_group.Example_Terraform_Testing.id}")
output "resource_group_id__full_value" { value = local.resource_group_id_full_value }
This will then output the whole string like this when running Terraform Plan or Apply: resource_group_id__full_value = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Example_Terraform_Testing"
To user substr you need to count the characters from the first / and the first / is 0 all / are a value. Unlike other languages that disregard special characters.
Once I had that as a local value I could then append that onto my local variable string like this:
sql_admin_login = format("${random_string.myrandom.id}-${local.resource_group_id}")
This will then give me the format I wanted like this, "qpncxt-00000000-0000-0000-0000-000000000000" and meet the account name requirements set by Azure, to be unique and to not have any special characters in and not to be too long. Also the great thing about substr is If I need the value to be shorter I just put in a lower number in the string.
Here is my full code to get this working:
locals {
# Ids for Resource Group, merged together with unique string
resource_group_id_full_value = format("${azurerm_resource_group.Example_In_The_Cloud_Terraform_Testing.id}")
resource_group_id = substr(("${azurerm_resource_group.Example_Terraform_Testing.id}"), 15, 36)
sql_admin_login = format("${random_string.myrandom.id}-${local.resource_group_id}")
sql_admin_password = format("${random_string.myrandom.id}-${local.resource_group_id}")
sql_server_name = format("sqlserver-${local.resource_group_id}")
}
resource "azurerm_mssql_server" "example_sql_server" {
name = local.sql_server_name
location = azurerm_resource_group.Example_Terraform_Testing.location
resource_group_name = azurerm_resource_group.Example_Terraform_Testing.name
version = "12.0"
administrator_login = local.sql_admin_login
administrator_login_password = local.sql_admin_password
minimum_tls_version = "1.2"
tags = {
environment = "production"
}
}
Links used to work this out:
Terraform Local Values: https://www.terraform.io/docs/language/values/locals.html
Terraform String Functions:
https://www.terraform.io/docs/language/functions/substr.html
Let's say, I would like to use a single object to represent a file and I'd like to get the filename (or path) of it so that I can use the name to remove the file or for other standard library procedures. I'd like to have a single abstraction which can be used with all available file-related standard library procedures.
I've found FileInfo but in my research I didn't find a get-file-name-procedure. File and FileHandle are pretty useless from a software engineering point of view because they provide no convenient abstraction and don't have members.
Is there a file abstraction (object) in Nim, which provides fast access to FileInfo as well as the file name so that a file doesn't need more than one procedure parameter?
There is no such abstraction in Nim, or any other language, simply because you are asking for an impossible thing to do with most filesystems. Consider the FileInfo structure and its linkCount field which tells you the number of hard links the file object has. But there is no way to get-a-filename from one or all of those links short of building and updating yourself a database of the whole filesystem.
While most filesystems allow access to files through paths, there is rarely a filesystem that gives paths from files because they actually don't need one! An example would be a Unix filesystem where one process opens a file through a path, then removes the path without closing the file. While the process holding the file open is alive, that file won't actually disappear, so you would have the case of a file without path.
The issue of handling paths, especially considering cross platform applications, involves its own can of worms: if you store paths as strings, what is the path separator and how do you escape it? Does your filesystem support volumes that require special case handling? What string encoding do paths use to satisfy all users? Just the encoding issue requires tons of tables and conversions which would bog down every other API wishing to get just a file like handle to read or write bytes.
A FileInfo is just a snapshot of the state of the file at a given time, a file handle is the live file object you can operate on, and a path (or many paths if your filesystem supports hard links) is just a convenience name for end users.
These are all very different things, which is why they are separate. Your app may need a more complex abstraction than other programmers are willing to tolerate, so create own abstraction which holds together all the individual pieces you need. For instance, consider the following structure:
import os
type
AppFileInfo = object
fileInfo: FileInfo
file: File
oneOfMany: string
proc changeFileExt(appFileInfo: AppFileInfo, ext: string): string =
changeFileExt(appFileInfo.oneOfMany, ext)
proc readAll(appFileInfo: AppFileInfo): string =
readAll(appFileInfo.file)
Those procs simply mimic the respective standard library APIs but use your more complex structure as inputs and transform it as needed. If you are worried about this abstraction not being optimised due to the extra proc call you could use a template instead.
If you follow this route, however, at some point you will have to ask yourself what is the lifetime of an AppFileInfo object: do you create it with a path? Do you create it from a file handle? Is it safe to access the file field in parts of your code or has it not been initialised properly? Do you return errors or throw exceptions when something goes wrong? Maybe when you start to ask yourself these questions you'll realise they are very app specific and are very difficult to generalise for every use case. Therefore such a complex object doesn't make much sense in the language standard library.
I created the missing solution myself. I basically extended the File type using a global encapsulated table. Extending Types like this could be a useful idiom in Nim because of UFCS.
import tables
type FileObject = object
file : File
mode : FileMode
path : string
proc initFileObject(name: string; mode: FileMode; bufsize = -1) : FileObject =
result.file = open(name, mode, bufsize)
result.path = name
result.mode = mode
var g_fileObjects = initTable[File, FileObject]()
template get(this: File) : var FileObject = g_fileObjects[this]
proc openFile*(filepath: string; mode: FileMode = fmRead; bufsize = -1) : File =
var fileObject = initFileObject(filepath, mode, bufsize)
result = fileObject.file
g_fileObjects[result] = fileObject
proc filePath*(this: File) : string {.raises: KeyError.} =
return this.get.path
proc fileMode*(this: File) : FileMode {.raises: KeyError.} =
return this.get.mode
from os import tryRemoveFile
proc closeOrDeleteFile[delete = false](this: File) : bool =
result = g_fileObjects.hasKey(this)
if result:
when delete:
result = this.filepath.tryRemoveFile()
g_fileObjects.del(this)
this.close()
proc closeFile*(this: File) : bool = this.closeOrDeleteFile[:false]
proc deleteFile*(this: File) : bool = this.closeOrDeleteFile[:true]
Now you can write
var f = openFile("myFile.txt", fmWrite)
var g = openFile("hello.txt", fmWrite)
echo f.filePath
echo f.deleteFile()
g.writeLine(g.filePath)
echo g.closeFile()
I'm trying to create an array with an assortment of different randomized image files in it to display on a set of buttons in Tkinter. When a given button is clicked I'd like to add the text of that file's name to a new array. Basically, when button with imageX is clicked add "imageX" to a new array.
Unfortunately, I always get a return that isn't the image's filename, or the variable that I've set to correspond to that image, but instead either:
"tkinter.PhotoImage object at X" (where is X is a location like "0x0000020FC894D2E0") if the command is populationbeta.append (population[0])
or
"pyimage#" (where # is an integer that seems to relate to the number of images in the source file), if I change the command to populationbeta.append (str(population[0]))
I feel like there should be a simple way of doing this and I've tried every work around I can think of but I'm not getting it to work. Any help would be very much appreciated! Thanks!
Here's a shortened/simplified version of the code in question:
master=tkinter.Tk()
master.title("Not working")
a1b1c1 = PhotoImage(file = r"C:/users/jdavis319/documents/bushesoflove/BoLdraw/a1b1c1.png")
a1b1c2 = PhotoImage(file = r"C:/users/jdavis319/documents/bushesoflove/BoLdraw/a1b1c2.png")
a1b1c3 = PhotoImage(file = r"C:/users/jdavis319/documents/bushesoflove/BoLdraw/a1b1c3.png")
a1b2c1 = PhotoImage(file = r"C:/users/jdavis319/documents/bushesoflove/BoLdraw/a1b2c1.png")
a1b2c2 = PhotoImage(file = r"C:/users/jdavis319/documents/bushesoflove/BoLdraw/a1b2c2.png")
population = [a1b1c1, a1b1c2, a1b1c3, a1b2c1, a1b2c2]
populationbeta = []
populationbeta.append(population[0])
print(populationbeta)
This gives the result: "[<tkinter.PhotoImage object at 0x000001A419D4F070>]"
This gives the result: "[<tkinter.PhotoImage object at 0x000001A419D4F070>]"
Correct. That shows that you have a list of PhotoImage objects. If you want the filenames you can use .cget('file') on the objects. cget is a common tkinter method for getting the value of a configured option.
filenames = [image.cget('filename') for image in population]
Or, if you don't want to use a list comprehension to create a list of filenames, you can do it on an individual image like so:
populationbeta.append(population[0].cget("file"))