Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - 3man75

Pages: [1] 2 3 ... 334
1
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 01, 2021, 10:15:49 pm »
Code: [Select]
Arturia_Picture = Image.open("Artoria_Face_Shots_1.jpg", 'r')
    for line in Arturia_Picture:
        Arturia_Picture.write(line)

First thing that jumps out to me is that you're trying to write to a file you've just opened for reading. Searching for "python image.open" led me to this article, regarding the PIL module.

Would this work?
Code: [Select]
Arturia_Picture = Image.open("Artoria_Face_Shots_1.jpg", 'r')
Arturia_Picture.show()

I'm going to try this in my code right now and let you know. Thank you!


EDIT: Okay so I uses some of the code as shown in the example that Bumber showed. But in addition I comented out that for loop as well as added the entire path.

I saw that as I added the entire path that Python gave me suggestions for what picture in my 'saved pictures' folder that I had. Picked the one I want and attempted to show it.

[Code/]

Arturia_Picture = Image.open("C:\Users\myName\Pictures\Saved Pictures\Artoria_Face_Shots_1.jpg", 'r')

    Arturia_Picture.show()

[Code\]

After running this code I get a truncation error. I'm going to do some research on what that is. A simple google search gave me this: "In numerical analysis and scientific computing, truncation error is the error caused by approximating a mathematical process. Let's take three examples so that the myths surrounding the definition of truncation error can be laid to rest."

Thank you Bumber for your help. I think I made progress on my little project here.

2
Hi everyone. I'm trying to make an image pop up in Python after running some things in the console. I'm still a newbie.

I have tried googling to find the right module / library for this but it all seems kinda archaic. The modules available seem there for machine learning and image analysis. Where as all I want to do is simply open up an image.

I kept looking and now I find myself here: https://www.pythonforbeginners.com/files/reading-and-writing-files-in-python

Essentially, I can potentially use open() to open a file. But when I tried to copy and paste the name inside of the parenthesis I was given an error.

Code: [Select]
Arturia_Picture = Image.open("Artoria_Face_Shots_1.jpg", 'r')
    for line in Arturia_Picture:
        Arturia_Picture.write(line)

Apologies for the weak question. It seems you guys are dealing with higher level threats...And I can't afford to give out sandwiches for help atm due to covid.

3
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 10, 2018, 12:29:04 am »
You seem to be missing the \ characters from the path.

The most likely reason is that \ is the escape code, for example when you write "\n" for a new line. A \ by itself always signifies that the next character is a special character code. \t for tab and \b for backspace are other examples.

A literal \ needs to be written as \\, so that it knows that it's representing the \ character itself and not being used as an escape code.
This is a standard thing, for example batch files use % for special codes, so %% means to write an actual %.

You can also write / instead of \ to specify paths (depends on the language), but it's good to be aware of the issue with using \.

This is also used to embed " characters inside a string delineated with " characters. You can use \" to add actual " characters inside the string.

like so?

Code: [Select]
img = ImageTk.PhotoImage(Image.open("C:\\Users\Javier\\Documents\\Valkyrie"))
Here is the iteration i'm on currently.

Code: [Select]
import tkinter
from PIL import ImageTk,Image

mainWindow = tkinter.Tk()

label = (mainWindow, "Valkur")

img = ImageTk.PhotoImage(Image.open("C:\\Users\\Javier\\Documents\\Valkyrie.JPG"))

mainWindow.create_image(20, 20, anchor=NW, image=img)

mainWindow.mainloop()


I asked the same qeustion on a programmers discord and I got this link from someone. https://www.c-sharpcorner.com/blogs/basics-for-displaying-image-in-tkinter-python

The link has a small article that has this bit:

Spoiler (click to show/hide)

I think i'm following the rules but ehhh. I'm so lost :(

4
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 09, 2018, 11:48:38 pm »
Code: [Select]
Simple task I set out for myself to help get better at coding was to display an image. I'm failing horribly again after picking this project up again. Can someone help?

[spoiler]
import tkinter
from PIL import ImageTk,Image

mainWindow = tkinter.Tk()

label = (mainWindow, "Valkur")

img = ImageTk.PhotoImage(Image.open("Valkyrie.jpg"))

mainWindow.create_image(20, 20, anchor=NW, image=img)

mainWindow.mainloop()

Errors:

Spoiler (click to show/hide)

Can someone explain to me this error a bit? If I understand the docs, the problem summary is the last bit right? Where it says that "FileNotFoundError" happened. I'm a little at a loss for words and while I did take some programming courses in college but if possible please explain as best as possible. I really don't want to be treated as anything but a noob in order to understand this.

5
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 13, 2017, 05:14:54 pm »
EDIT

NEVER PAY ATTENTION TO ME

6
I made thing work in Java. I went for a training exercise where the program prints out an object with things inside which in my case is a space marine chapter. I can make 1000 space marines with the name of recruit, the awesome weapon known as a bolter, and have health of '10'.
Spoiler (click to show/hide)
Spoiler (click to show/hide)

Inside are my two classes. Kinda proud I was able to do this on my own :)

7
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: February 22, 2017, 11:11:46 pm »
Anyone know how to find out what games are coded with? For example what's Football Manager 2017 coded by? C++? Java? Python? Ruby?


8
Forum Games and Roleplaying / Re: SPAMKINGDOM: Queen Elana of Luathbas!
« on: February 01, 2017, 05:52:00 pm »
A

9
Forum Games and Roleplaying / Re: SPAMKINGDOM: Queen Elana of Luathbas!
« on: January 29, 2017, 08:34:55 pm »
C

10
Forum Games and Roleplaying / Re: SPAMKINGDOM: Queen Elana of Luathbas!
« on: January 27, 2017, 09:04:47 pm »
B

Rebellion eh? We'll show these rebel scum to never raise their hand against the monarchy again!

11
Forum Games and Roleplaying / Re: Seeker of Spellcraft (SG)
« on: January 27, 2017, 07:53:16 pm »
Leave. The Mage's Bastard is unpleasant to begin with and this has just soured the mood further.

+1

12
Forum Games and Roleplaying / Re: Seeker of Spellcraft (SG)
« on: January 27, 2017, 07:49:52 pm »
I'm gearing up for the return to the tower, which is probably going to be a much bigger update. In the meantime, we've got a bit of a tie.

Woot!

13
Forum Games and Roleplaying / Re: SPAMKINGDOM: Feodh of Luathbas!
« on: January 08, 2017, 10:43:36 pm »
C

14
Forum Games and Roleplaying / Re: Factions
« on: January 07, 2017, 07:02:13 pm »
This game was inspired in part by my other game and by a game on another forum.


What other forum was it? Can you PM it to me?

15
Forum Games and Roleplaying / Re: SPAMKINGDOM: Feodh of Luathbas!
« on: January 05, 2017, 07:55:16 pm »
A

Pages: [1] 2 3 ... 334