Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
J

johtnkucz

@johtnkucz
About
Posts
14
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Python Pygame Newbie Code Help
    J johtnkucz

    Hi, I execute the following code and just get a blank (black) window. The window caption shows but I have not yet gotten the images to load. Please help. (I tried using other images than the ones utilized too). the .py and the images are in the same directory.

    background_image_filename='checkmark.jpg'
    mouse_image_filename='digestive_bw.png'
    import pygame, sys
    from pygame.locals import*
    from sys import exit

    pygame.init()

    screen=pygame.display.set_mode((800,800),0,32)
    #pygame.display.set_caption("Hello, Howdy, Mate, and Hi there Aus world!")

    background=pygame.image.load(background_image_filename).convert()
    mouse_cursor=pygame.image.load(mouse_image_filename).convert_alpha()

    while True:
    for event in pygame.event.get():
    if event.type==QUIT:
    pygame.quit()
    sys.exit()

    screen.blit(background,(0,0))

    x,y=pygame.mouse.get_pos()
    x-=mouse_cursor.get_width() /2
    y=-mouse_cursor.get_height() /2
    screen.blit(mouse_cursor,(x,y))

    pygame.display.update()

    JavaScript python help announcement

  • Installing Pygame
    J johtnkucz

    actually I might be able to accomplishe some gui things with tkinter but want to install pygame.

    JavaScript help python linux

  • Installing Pygame
    J johtnkucz

    Hey mates, have been trying to install pygame and can't get it to install. It and it's corresponding 3.2 python installs appropriately but 'import pygame' doesn't recognize the module. Have tinkered with 32 and 64-bit versions. >>>> Traceback (most recent call last): File "", line 1, in import pygame ImportError: No module named pygame >>>>>> Is the error message. Have tried to install this on linux and windows 7...getting very vexed at seeing that error message. I NEED to install pygame. Any assistance with this would help. Thanks.

    JavaScript help python linux

  • Python Bulk-Renamer for Date-Modified
    J johtnkucz

    #There was no python sub-category forum, so posted this here. --------------------- Hey mates, on ubuntu-linux. I need/want to code a python applicaton that does the following: takes the 'date-modified' of the file (almost always a .jpg jpeg) and adds a 8 digit format string to the beginning of it. I have manually using pyrenamer to rename them. When I have many files all on the same date. this works, but but but, when I have many files on different dates this is tedious. the format string would be: EXAMPLE; file modified on 2012-17-Mar change name to 20120317_num where num is just a two digit numbe 01,02,... Any ideas on how I would start to code such an app. It is a relatively simple process but I fear it will be complex to code and outside of my skill-level and will need to research a lot of things like how to get the date-modified information manipulating/changing the string of 2012-17-Mar I could see a lot of if-elses for the 12 months and whatnot. Relatively simple concept; currently outside of my abilities as a coder, but this would be great to code. If anyone has any resources on how to do this, would be rewarding for me to code, would be freakishly useful, and would safe time. thanks! pyrenamer is super bulk-file-renamer (the best i've seen across mac, windows, and linux OSes) but that specific usage where it takes the file format etc is complex. I guess I would rather find such an app (to process files) AND THEN code a separate one for the reward of coding. Recently i've been making folders of month and then subfolders of day and putting corresponding date-modified files in the month/day folder and then using pyrenamer. again, tedious when have many 'different days' of date-modified.

    JavaScript linux tutorial python

  • Long OverDue Newb Game Project
    J johtnkucz

    This is helpful (and obvious). I don't know why. I guess I have had too much (WAY) too much going on. Just start doing it is pretty vague though. I would need to have all libraries installed, know how to do that, etc. there's a lot of steps. I do look forward to this project though.

    Game Development workspace java python game-dev help

  • Scanner isn't scanning Strings Correctly.
    J johtnkucz

    OMG I realized this is the exact same problem I had before when posting on my first post. I need to use a String.equals() comparison for strings in the if-conditional. I will try that. (thanks...to my recollection of solving that problem the first time! lol xD). Marvelous. got it. Sweet. solved. nice code symmetry (start code and end fixed code, too)!

    import java.util.Scanner;

    public class ScannerTester{
    public static void main (String args[]){

    Scanner aScanner_input = new Scanner(System.in);
    String aScanner;
    aScanner= aScanner_input.next();
    if (aScanner.equals("s")){
    System.out.println("aScanner is s!");
    }
    if (aScanner.equals("Y")){
    System.out.println("aScanner is Y!");
    }

    }
    }

    //*/

    Java java help question

  • Scanner isn't scanning Strings Correctly.
    J johtnkucz

    import java.util.Scanner;

    public class ScannerTester{
    public static void main (String args[]){

    Scanner aScanner_input = new Scanner(System.in);
    String aScanner;
    aScanner= aScanner_input.nextLine();
    if (aScanner == "s"){
    System.out.println("A Scanner is s!");
    }
    if (aScanner == "Y"){
    System.out.println("A scanner is Y!");
    }

    }
    }

    Hey, the code is above. I wager this is some kind of cast or data type problem. I tried aScanner_input.next() and aScanner_input.nextLine(). With both it doesnt' recognize Y as Y and s as s!?!! i.e. none of the if-blocks can get accessed regardless of input. I can get scanner to work with other data types like int (and nextInt()). Appreciate if anyone knows what's going on. Cheers. Thanks. (*I love this forum. Very helpful. And as said before, I go to this forum and I don't use stackoverflow). Thanks!

    Java java help question

  • Long OverDue Newb Game Project
    J johtnkucz

    are you serious? If so...thanks for the encouragement. I don't see how my rambling about what obstacles could be thwarting moving forward in game coding project would be helpful to anyone (except possibly myself or someone with a similar conundrum), but thanks!

    Game Development workspace java python game-dev help

  • Long OverDue Newb Game Project
    J johtnkucz

    I will work with this set of singapore java tutorials. I know I am extremely picky with what resources (tutorials, author, pace, etc) are helpful and..well if a useful compatible learning resource, will prob accomplish this project quite quickly.

    Game Development workspace java python game-dev help

  • Long OverDue Newb Game Project
    J johtnkucz

    My first exchange on this site/forums was one of the most helpful I've ever experienced (I can't calculate how many forums and topics I've posted to but it's well over hundreds), so I don't want to post something as general as this. I like posting comments after working on a problem and getting stumped and knowing there's one small precise answer. Unfortunatley (I will not do posts like this) because this is more general. The scenario is i've been wanting to build a game for a LONG time. But I focus on code and a language (almost always java and recently, what I prefer, python), then get distracted or occupied with some other project or thing in life and then months or years later return to the making the game project. It coudl be brick out or tictactoe. Something very simple. but I want to understand every line of code in it (so just typing out and copying code wouldn't suffice). I often get entangled on which language (java is widespread, but python I almost always prefer and understand better and seems more elegant) and then getting the IDEs setup and packages etc. I also guess I want to really understand every component of the (probably very simple) game application (so I can add on more later). I picked up Ian Cinnamon. programming video games for evil genius (java) Game Dev with python and pygame. Will McGugan. But I am very selective with learnign resources and like 5% of learning resources only actually "work". I found an excellent singapore tutorial site that helped me understand some aspects of java I could never comprehend until recently. I end up taking notes and blogging on concepts I learn in the books and don't want to just type out the code without understanding it, but have a huge snag with the project of "make a game". I'm proud most all learnings I've done with computers have been primarily autodidactic. I did take one comp. sci. class but greatly disliked the class environment. But in that class (which did more harm and was more confusing than good because of infusing grades and teacher-student hell stuff with just something I wanted to learn. didn't care about grades just want to code!) but was paired with someone very advanced in comp. sci. and made chess game. I had no idea what he was doing. This is rambly and too general and a mess of a post and i won't post posts like this on this site (only if have very specific "stumped" code question) but wondered if anyone has ideas on making a game. Maybe I'm just more in a learning about code phase.

    Game Development workspace java python game-dev help

  • Comparing Strings Reverse if-conditional
    J johtnkucz

    I never rely on luck. I prefer efficiency and preparation (and utilizing awesome resources like this site!)!! Seriously thanks for the positive feedback...on my positive feedback!! Seriously though This is my number one code-help (I have other resources for tutorials and stuff but if get stuck and need help) this owns other sites, including stack overflow. Your response was extremely helpful. thanks again so much for looking at code. And re stackoverflow. I hate that site. Most comments and posts have this gross disgusting milieu of (ooh look how much coding I know or some cheesy leet rubbish of "no, you're supposed to post this way..or that way.." or whatever. I just was thoroughly stumped, chucked up some code: 1. got the EXACT answer that was the prob 2. learned somethign I never fully understood even after a wretched computer science class and most all autodidactic(== compares objects not content of objects and strings may be equal but diff objects, so if linked to diff objects same content will appear as not equal because their objects are not equal but their content is) . That's the epitome of helpful. Anyways if one gets similar exchanges, this is num 1 code resource. good times. The layout of forum posts/responses is unique and novel but appealing, too. Good tiems. Were you involved in making this site or something, or just prefer this (anti overflow) to other sites, too. Cheers. thanks.

    Java help question java

  • Comparing Strings Reverse if-conditional
    J johtnkucz

    oh bloody hell. was so excited to see a response, didn't even notice that you linked something. I researched and found "The == operator will only be true if two String references point to the same underlying String object. Hence two Strings representing the same content will be equal when tested by the equals(Object) method, but will only by equal when tested with the == operator if they are actually the same object." which I "sorta" understand. like same object in memory referenced and two diff objects but with same string value (== only works as true with the former) so == seems to compare objects in memory and String.equals() actually compares Strings (content of String objects). Sweet am finally getting this a bit!! Thanks for such complete answer...and now that that obstacle is resolved, my coding can progress for the day! (Also I tried it and now that mini-app totally works. Thanks again!) This is site is so much better than stackoverflow haha.

    Java help question java

  • Comparing Strings Reverse if-conditional
    J johtnkucz

    Hey really? Thanks Richard MacCutchan! Thanks for taking the time to look at that code, too. It's not yet solved b/c I have to try that comparison method, but thanks!! However, I thought it was something like that so made a mini test program. String var1 = "hello"; String var2 = "hello"; if (var1==var2){ System.out.println("equal!"); } and THAT did show they were equal. If the String.equals() method works (and gets my ReverseString.java program to work, why would that above var1==var2 work but not so with inputString and reverseString? Thanks!!

    Java help question java

  • Comparing Strings Reverse if-conditional
    J johtnkucz

    the (inputString == reverseString) if-conditional always returns false (even if it is true. please help. Couldn't figure this out. thanks.

    import java.util.Scanner;
    public class ReverseString{
    public static void main (String[] args){
    String inputString="";
    int inputStringLength;
    String reverseString="";
    String stringHolder="";
    //String reverseNumString = "";

    Scanner in = new Scanner(System.in);
    System.out.print("Enter a String: ");
    inputString = in.next();
    inputStringLength = inputString.length();
    System.out.println("Input String is : " +inputString);
    for (int i = 0; i<inputStringLength; i++){
    stringHolder = inputString.charAt(i) + stringHolder;
    reverseString = stringHolder;
    }
    System.out.println(reverseString);
    System.out.println("inputString = " + inputString);
    System.out.println("input length =" + inputString.length() + "reverse length " +reverseString.length());
    System.out.println("Now let's test to see if your input is a palindrome (like hannah or 'a man, a plan, a canal, panama') \\n" + "Does "+ inputString +" = the same forward and reversed? \\n^^^ \\n^^^ " );
    if (inputString == reverseString){
    	System.out.println("yes!");
    	System.out.println(" YES!! Eureka!  " + inputString + " == " + reverseString + "!  Thus, " + inputString + " is a palindrome! gratzee!");
    }else {
    	System.out.println("no");
    	System.out.println("NO!! \\n" + inputString + " != (does not equal) " + reverseString + "\\n So " + inputString + "is not a palindrome!  Oh well no prob!" );
    }
    

    }//end main
    } //end class

    I've tried using scaffolding code to test for what is going on. I think someway reverseString is created may be a problem. But when I print reverseString and inputString they both have the same string length and visibly the same characters...so I don't know what the solution is at present.

    Java help question java
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups