[python 2.7] how do I change text of tkinter button widget via /r/learnprogramming


[python 2.7] how do I change text of tkinter button widget

I am writing a basic calculator app and want to change the text of the clear button from "C" when there are numbers in the display, to "AC" when there are no numbers (technically when the display is 0) in the display.

How do I change the text of the button with click events from the C/AC button and other number buttons as well?

Submitted November 30, 2015 at 06:18PM by heisenberger
via reddit http://ift.tt/1lqNxEj

[c++]getline not working, bizarre, never had this problem before. via /r/learnprogramming


[c++]getline not working, bizarre, never had this problem before.

So I've tried all the standard methods, cin.ignore(), use another getline to get any trailing whitspace or whatever that was left behind from previous cin's… So like I have this.

 string item_name = ""; double item_price = 0.00; cout << "\n\n\t\t\t\t\tEnter Item: "; cin.ignore(); getline(cin, item_name); while (item_name != "*") { item_names.push_back(item_name); cout << "\t\t\t\t\tEnter Price: $"; cin >> item_price; item_prices.push_back(item_price); cout << "\n\t\t\t\t\tEnter Item: "; getline(cin, garbage_collecter); getline(cin, item_name); }; 

You can see both methods being implemented here. However, when I put in input on the first one, even when I use the garbage_collecter way, I end up triggering an infinite loop where it prints out the "Enter [stuff]" side by side until I hit ctrl+c.

What the hell is going on here? This happens anytime I use getline but I need to be able to include spaces 😥

Submitted November 30, 2015 at 06:25PM by zthompson2350
via reddit http://ift.tt/1PWRUUA

I’m a competent programmer and have a lot of experience with a few languages, but I’m about to undertake a bit of C++. What are the first projects/exercises I should do, as someone who already knows how to program? via /r/learnprogramming


I’m a competent programmer and have a lot of experience with a few languages, but I’m about to undertake a bit of C++. What are the first projects/exercises I should do, as someone who already knows how to program?

I'm proficient in a few languages. I'm in my third year of Computer Science, so I no longer really struggle to pick up new languages. C++ however, sounds like an enormous beast to tackle.

My primary languages are Java and Python. As someone who already knows how to program:

  • What are the key points of C++ to be aware of while learning?
  • What are the best exercises to learn these key points?
  • What are the best starter-projects for C++, that will help me become a good C++ programmer?

Submitted November 30, 2015 at 06:27PM by good_piggy
via reddit http://ift.tt/1SsJmTq

[C#, Unity] Live Game Development on Twitch via /r/learnprogramming


[C#, Unity] Live Game Development on Twitch

Hey!

This is a cross post from /r/gamedev as this might be interesting here too. I would love to hear if there's and feedback or suggestions for this?

On this Thursday (3. December) I will do a pilot of a project I have been thinking of where I develop a game live on Twitch. The watchers can use the chat to interact with the development, but the main goal is to teach Game Development using Unity3d.

I'm thinking one hour episodes over a scheduled timeframe, where we develop the game, and then go through different options for monetizing as well as publishing.

My ambition is that anyone can see this for learning & inspiration, so no pre-requisites and knowledge required. But if you have some basic understanding of programming and graphics theory, it will help. I will try to include as much 101 as possible to help as many as possible to follow.

The sessions will also be recorded and posted on YouTube, so anyone who is missing out on an episode or want to watch it again, can do this.

The source will also be open on GitHub, available for anyone to play around with and reuse, probably under MIT license.

What are your thoughts?

Here is my announcement post for the pilot, a test session that I will use to make sure everything is working and also create the initial episode: http://ift.tt/21psJhh

Thanks! 🙂

Submitted November 30, 2015 at 06:28PM by OmegaDish
via reddit http://ift.tt/1SsJjqD

Hello /r/learnprogramming. We are working on a curriculum! What do you think? via /r/learnprogramming


Hello /r/learnprogramming. We are working on a curriculum! What do you think?

We are working to develop a free computer science curriculum combining YouTube and GitHub to help people learn how to code! It is an introductory course, covering the basics of web development in HTML, CSS, and JavaScript and basic Python programming, as well as a broader overview of computer science in general.

Preview video on YouTube

Any suggestions from /r/learnprogramming? Thanks!

Submitted November 30, 2015 at 06:33PM by bitwisr
via reddit http://ift.tt/1lqOcWf

what is a char**? i know char* is a pointer to a char. via /r/learnprogramming


what is a char**? i know char* is a pointer to a char.

char * s = "john", creates a pointer called S. Pointer S is a memory address to somehwere on the heap or is it the stack? to a memory address of the letter j.

so what is a char ** , and wha'ts it for?

Submitted November 30, 2015 at 06:09PM by kenshinere9919934
via reddit http://ift.tt/1l3tbS0