Shared posts

04 Nov 16:23

How Newt Gingrich 'Broke Politics'

'Atlantic' journalist McKay Coppins says that by the time the former speaker of the house left Congress in 1999, he had enshrined a "combative, tribal, angry attitude in politics that would infect our national discourse in Washington and Congress for decades to come." Coppins explains how Gingrich set the stage for President Trump's rise, and how Democrats are now using some of his tactics. Coppins' new article is 'The Man Who Broke Politics.'

Also, critic David Edelstein reviews the Orson Welles film 'The Other Side of the Wind,' which was unfinished before his death — now complete and streaming on Netflix.
04 Nov 02:08

The Peterloo Massacre

Tom Roche

bit beige/milquetoast though

Historian and author Jacqueline Riding discusses the tragic events of August 1819

For information regarding your data privacy, visit acast.com/privacy
04 Nov 02:05

Assange Case Shows Support for Free Speech Depends on Who’s Talking

by Joe Emersberger
Tom Roche

puncturing the egregiously so-called Committee to Protect Journalists (CPJ)

by Joe Emersberger

Guardian: How to Get Rid of an Unwanted Housemate

Julian Assange, whom the UN has declared to be “arbitrarily detained” by Britain and Sweden, is used by the Guardian (10/17/18) to illustrate a gag story on “nightmare flatmates.”

The UN Working Group on Arbitrary Detention concluded in February 2016 that the governments of the UK and Sweden had forced WikiLeaks publisher Julian Assange into a condition of arbitrary detention in the Ecuadorian embassy in London, where he has been since 2012. The group’s press release stated:

The expert panel called on the Swedish and British authorities to end Mr. Assange’s deprivation of liberty, respect his physical integrity and freedom of movement, and afford him the right to compensation.

Assange has never been charged with a crime in Sweden. At the secret urging of the UK government, Sweden refused for several years to question Assange in London regarding sexual assault allegations. That kept the case in “preliminary investigation” limbo, while Sweden also refused to guarantee that Assange would not be extradited to the United States, where he is likely to face prosecution for his work as a publisher.

Emails between UK and Swedish officials show that Swedish officials were getting “cold feet” in 2013, and were considering dropping the “preliminary investigation” into Assange, but the UK argued forcefully against it.  Last year, Sweden finally dropped the investigation (shortly after it finally agreed to interrogate Assange in London, as it could easily have done years earlier), but the UK has been using the allegation that Assange skipped bail as a way to hold the threat of extradition to the United States over his head.

In March of this year, Ecuadorian President Lenin Moreno made the conditions of Assange’s arbitrary detention much worse. For seven months, Assange has been without any means to directly communicate with the public—in other words, to defend himself from relentless attacks and ridicule in Western media. Moreno has not only cut off Assange’s internet and telephone access, but also severely restricted visits. Moreno has openly stated that he silenced and isolated Assange because he objected to Assange’s political statements, but rather than blast Moreno for trampling Assange’s right to free expression and other basic rights, the international press and prominent “human rights” organizations have responded with silence, distortions and even smirks.

NBC: Julian Assange fights asylum terms dictating he has to pay for food, cat care

NBC News‘ headline (10/19/18) finds the lighter side of being held incommunicado.

“Julian Assange Fights Asylum Terms Dictating He Has to Pay for Food, Cat Care,” chuckled an NBC News headline to a Reuters article (10/19/18) by Alexandra Valencia. The article reported inaccurately that

Assange has not had access to the internet since it was cut off in March, [Assange lawyer Baltasar] Garzon added, despite a WikiLeaks statement this week that it had been restored.

In fact, Wikileaks said that Assange’s isolation was “to be partially lifted,” but then, days before this mocking NBC headline appeared, WikiLeaks had stated:

Although Ecuador stated, hours after UN Special Rapporteurs on Press & Refugees met with its president on Friday, that @JulianASsange’s isolation would be lifted Monday, he remains isolated. A 2 pm appointment on Tuesday, with a legal advisor, was not let into the embassy.

Seems there is no time for accurate reporting about Assange’s treatment when you’re busy making a mean-spirited joke of it all. The Guardian (10/17/18) published an article prominently referring to Assange with the headline “How to Get Rid of an Unwanted Housemate.” Vice (10/22/18) similarly depicted Assange as a rude houseguest abusing the generosity of his hosts:

The Ecuadorian embassy recently demanded that Assange clean his bathroom, feed his cat, and stay out of heated online debates. Now he’s suing them for it.

Vice: Julian Assange is Suing the Embassy that’s Been Offering Him Asylum

By “stay out of heated online debates,” Vice (10/22/18) means that Ecuador refuses to allow Assange access to the internet unless he agrees not to express political opinions.

How did all these journalists miss that Item 24 of Ecuador’s “recent demands” explicitly prohibits Assange from engaging in any speech that is “political and that could interfere the internal affairs of other states or damage Ecuador’s good relations with another state”? In September, Moreno  told AP (9/27/18):

If Mr Assange promises to stop emitting opinions on the politics of friendly nations like Spain or the United States, then we have no problem with him going online.

I have contacted the Committee to Protect Journalists (CPJ) several times by phone, email and through Twitter over the past few weeks, asking them why I have not found any comment from them denouncing Moreno’s silencing of Assange, explicitly on political grounds. When I finally reached a CPJ official by phone, I was told me they have “reported” on Assange’s case. No kidding. What they haven’t ever done is denounce Moreno’s ruthlessness towards Assange.

In contrast, CPJ frequently criticized Moreno’s predecessor, Rafael Correa (who made the original decision to give Assange asylum) over alleged violations of press freedom. Moreno won the presidency in 2017 by running as a staunch Correa loyalist. Immediately after taking office, Moreno shifted dramatically to the right, disavowed the longstanding ties to Correa that he used to get elected, and, crucially, ensured that public media no longer provided a counterweight to Ecuador’s right-wing private media that always attacked Correa.

Ecuador’s private media is similar to Brazil’s, which did so much to bring an outright fascist to victory in its presidential election. An Ecuadorian journalist was just convicted in Belgium for threatening and harassing Rafael Correa and his daughter. Moreno’s alliance with the private media has enabled him to make audacious attacks on the constitution and judicial independence, while receiving flattering press coverage internationally. As noted in an interview I did with Ecuadorian legal scholar Oswaldo Ruiz-Chiriboga (CounterPunch, 10/12/18), Jose Miguel Vivanco, the Americas director for Human Rights Watch, has frequently applauded Moreno for those attacks.

To be fair, another Human Rights Watch official, Dinah Pokempner, said in April:

Whether it agrees or not with what Julian Assange says, Ecuador’s denying him access to the Internet as well as to visitors is incompatible with its grant of asylum. His refuge in the embassy looks more and more like solitary confinement.

In an op-ed in which Pokempner also criticized Moreno, she wrote that Human Rights Watch had been denied permission to visit Assange in May. That hasn’t stopped Vivanco from gushing over Moreno’s government since that visit was denied.

As mentioned above, Assange (who was made an Ecuadorian citizen by Moreno’s government in a failed tactical move to end his stay in the embassy) is suing Moreno’s government in Ecuadorian courts. However, Moreno has a handpicked body (the “transitory” CPCCS) sitting atop the entire judiciary (CounterPunch, 10/12/18). It has illegally fired the Constitutional Court, the National Electoral Council and numerous other authorities. Winning against Moreno under these conditions will be very tough, given that judges who displease Moreno will likely be fired or otherwise disciplined—including by being smeared in Ecuador’s public and private media. You can count on the international press and “press freedom” organizations either saying nothing or laughing it off, unless truly independent voices speak up.

 

02 Nov 20:13

- - Doug Henwood

Tom Roche

Amanda Armstrong on the importance of trans politics • Alfredo Saad-Filho on the prospects for Brazil under the fascist Bolsonaro

31 Oct 18:01

Brazil's brutal swing to the far-right

Tom Roche

Glenn Greenwald

Jair Bolsonaro, Brazil’s new President elect, has been dubbed the “Trump of the Tropics.” But what if he’s closer to Duterte and Pinochet?
31 Oct 17:40

Colm Toibin - Fathers and Sons

Tom Roche

short download as of 1730 UTC W 31 Oct (abends @ 6:38)

How did the fathers of James Joyce, Oscar Wilde and WB Yeats shape the lives and writing of their famous sons?
30 Oct 17:59

Test and Code: 51: Feature Testing

Andy Knight joins me in discussing the concept of feature testing.

A feature tests is "a test verifying a service or library as the customer would use it, but within a single process." That was a quote from an article that appeared on the Twitter engineering blog. The article describes a shift away from class tests towards feature tests, the benefits of the shift, and some reactions to it.

Feature tests are similar to something I used to call "functional subcutaneous integration test", but it's a way better name, and I plan to use it more often.

The idea fits well with my testing philosophy. Andy Knight is someone still holding onto the testing pyramid. So I thought it would be fun to ask him to discuss feature testing with me. I think it's a balanced discussion. I hope you enjoy it and learn something.

Special Guest: Andy Knight.

Sponsored By:

Support Test and Code

Links:

<p>Andy Knight joins me in discussing the concept of feature testing.</p> <p>A feature tests is &quot;a test verifying a service or library as the customer would use it, but within a single process.&quot; That was a quote from an article that appeared on the Twitter engineering blog. The article describes a shift away from class tests towards feature tests, the benefits of the shift, and some reactions to it.</p> <p>Feature tests are similar to something I used to call &quot;functional subcutaneous integration test&quot;, but it&#39;s a way better name, and I plan to use it more often.</p> <p>The idea fits well with my testing philosophy. Andy Knight is someone still holding onto the testing pyramid. So I thought it would be fun to ask him to discuss feature testing with me. I think it&#39;s a balanced discussion. I hope you enjoy it and learn something.</p><p>Special Guest: Andy Knight.</p><p>Sponsored By:</p><ul><li><a rel="nofollow" href="http://testandcode.com/pycharm">PyCharm Professional</a>: <a rel="nofollow" href="http://testandcode.com/pycharm">We have a special offer for you: any time before December 1, you can get an Individual PyCharm Professional 4-month subscription for free! If you value your time, you owe it to yourself to try PyCharm.</a></li></ul><p><a rel="payment" href="https://www.patreon.com/testpodcast">Support Test and Code</a></p><p>Links:</p><ul><li><a title="Twitter engineering blog article describing Feature Testing : The testing renaissance" rel="nofollow" href="https://blog.twitter.com/engineering/en_us/topics/insights/2017/the-testing-renaissance.html">Twitter engineering blog article describing Feature Testing : The testing renaissance</a></li></ul>
25 Oct 17:28

Stack Abuse: Python GUI Development with Tkinter: Part 2

This is the second installment of our multi-part series on developing GUIs in Python using Tkinter. Check out the links below for the other parts to this series:

Introduction

In the first part of the StackAbuse Tkinter tutorial series, we learned how to quickly build simple graphical interfaces using Python. The article explained how to create several different widgets and position them on the screen using two different methods offered by Tkinter – but still, we barely scratched the surface of the module's capabilities.

Get ready for the second part of our tutorial, where we'll discover how to modify the appearance of our graphical interface during our program's runtime, how to cleverly connect the interface with the rest of our code, and how to easily get text input from our users.

Advanced Grid Options

In the last article, we got to know the grid() method that lets us orient widgets in rows and columns, which allows for much more ordered results than using the pack() method. Traditional grids have their disadvantages though, which can be illustrated by the following example:

import tkinter

root = tkinter.Tk()

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=1, row=0, sticky="nsew")  
frame3.grid(column=0, row=1, sticky="nsew")

label1 = tkinter.Label(frame1, text="Simple label")  
button1 = tkinter.Button(frame2, text="Simple button")  
button2 = tkinter.Button(frame3, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')

root.mainloop()  

Output:

The code above should be easily understandable for you if you went through the first part of our Tkinter tutorial, but let's do a quick recap anyway. In line 3, we create our main root window. In lines 5-7 we create three frames: we define that the root is their parent widget and that their edges will be given a subtle 3D effect. In lines 9-11 the frames are distributed inside the window using the grid() method. We indicate the grid cells that are to be occupied by each widget and we use the sticky option to stretch them horizontally and vertically.

In lines 13-15 we create three simple widgets: a label, a button that does nothing, and another button that closes (destroys) the main window – one widget per frame. Then, in lines 17-19 we use the pack() method to place the widgets inside their respective parent frames.

As you can see, three widgets distributed over two rows and two columns do not generate an aesthetically pleasing outcome. Even though frame3 has its entire row for itself, and the sticky option makes it stretch horizontally, it can only stretch within its individual grid cell's boundaries. The moment we look at the window we instinctively know that the frame containing button2 should span two columns – especially considering the important function that the button executes.

Well, luckily, the creators of the grid() method predicted this kind of scenario and offers a column span option. After applying a tiny modification to line 11:

import tkinter

root = tkinter.Tk()

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=1, row=0, sticky="nsew")  
frame3.grid(column=0, row=1, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label")  
button1 = tkinter.Button(frame2, text="Simple button")  
button2 = tkinter.Button(frame3, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')

root.mainloop()  

We can make our frame3 stretch all the way across the entire width of our window.

Output:

The place() Method

Usually when building nice and ordered Tkinter-based interfaces, place() and grid() methods should satisfy all your needs. Still, the package offers one more geometry manager – the place() method.

The place() method is based on the simplest principles out of all three of Tkinter's geometry managers. Using place() you can explicitly specify your widget's position inside the window, either by directly providing its exact coordinates, or making its position relative to the window's size. Take a look at the following example:

import tkinter

root = tkinter.Tk()

root.minsize(width=300, height=300)  
root.maxsize(width=300, height=300)

button1 = tkinter.Button(root, text="B")  
button1.place(x=30, y=30, anchor="center")

root.mainloop()  

Output:

In lines 5 and 6 we specify that we want the dimensions of our window to be exactly 300 by 300 pixels. In line 8 we create a button. Finally, in line 9, we use the place() method to place the button inside our root window.

We provide three values. Using the x and y parameters, we define exact coordinates of the button inside the window. The third option, anchor, lets us define which part of the widget will end up at the (x,y) point. In this case, we want it to be the central pixel of our widget. Similarly to the sticky option of grid(), we can use different combinations of n, s, e and w to anchor the widget by its edges or corners.

The place() method doesn't care if we make a mistake here. If the coordinates happen to point to a place outside our window's boundaries, the button will not be displayed. A safer way of using this geometry manager is using coordinates relative to the window's size.

import tkinter

root = tkinter.Tk()

root.minsize(width=300, height=300)  
root.maxsize(width=300, height=300)

button1 = tkinter.Button(root, text="B")  
button1.place(relx=0.5, rely=0.5, anchor="center")

root.mainloop()  

Output

In the example above, we modified line 9. Instead of absolute x and y coordinates, we now use relative coordinates. By setting relx and rely to 0.5, we make sure that regardless of the window's size, our button will be placed at its center.

Okay, there's one more thing about the place() method that you'll probably find interesting. Let's now combine examples 2 and 4 from this tutorial:

import tkinter

root = tkinter.Tk()

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=1, row=0, sticky="nsew")  
frame3.grid(column=0, row=1, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label")  
button1 = tkinter.Button(frame2, text="Simple button")  
button2 = tkinter.Button(frame3, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')

button1 = tkinter.Button(root, text="B")  
button1.place(relx=0.5, rely=0.5, anchor="center")

root.mainloop()  

Output:

In the example above we just took the code from example 2 and then, in lines 21 and 22, we created and placed our small button from example 4 inside the same window. You might be surprised that this code does not cause an exception, even though we clearly mix grid() and place() methods in the root window. Well, because of the simple and absolute nature of place(), you can actually mingle it with pack() and grid(). But only if you really have to.

The result, in this case, is obviously pretty ugly. If the centered button was bigger, it will affect the usability of the interface. Oh, and as an exercise, you can try moving lines 21 and 22 above the definitions of the frames and see what happens.

It is usually not a good idea to use place() in your interfaces. Especially in larger GUIs, setting (even relative) coordinates for every single widget is just a lot of work and your window can become messy very quickly – either if your user decides to resize the window, or especially if you decide to add more content to it.

Configuring the Widgets

The appearance of our widgets can be changed while the program is running. Most of the cosmetic aspects of the elements of our windows can be modified in our code with the help of the configure option. Let's take a look at the following example:

import tkinter

root = tkinter.Tk()

def color_label():  
    label1.configure(text="Changed label", bg="green", fg="white")

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=1, row=0, sticky="nsew")  
frame3.grid(column=0, row=1, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label")  
button1 = tkinter.Button(frame2, text="Configure button", command=color_label)  
button2 = tkinter.Button(frame3, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')

root.mainloop()  

Output:

In lines 5 and 6 we added a simple definition of a new function. Our new color_label() function configures the state of label1. The options that the configure() method takes are the same options that we use when we create new widget objects and define initial visual aspects of their appearance.

In this case, pressing the freshly renamed "Configure button" changes the text, background color (bg), and foreground color (fg – in this case it is the color of the text) of our already-existing label1.

Now, let's say we add another button to our interface that we want to be used in order to color other widgets in a similar manner. At this point, the color_label() function is able to modify just one specific widget displayed in our interface. In order to modify multiple widgets, this solution would require us to define as many identical functions as the total number of widgets we'd like to modify. This would be possible, but obviously a very poor solution. There are, of course, ways to reach that goal in a more elegant way. Let's expand our example a little bit.

import tkinter

root = tkinter.Tk()

def color_label():  
    label1.configure(text="Changed label", bg="green", fg="white")

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame4 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame5 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=0, row=1, sticky="nsew")  
frame3.grid(column=1, row=0, sticky="nsew")  
frame4.grid(column=1, row=1, sticky="nsew")  
frame5.grid(column=0, row=2, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label 1")  
label2 = tkinter.Label(frame2, text="Simple label 2")  
button1 = tkinter.Button(frame3, text="Configure button 1", command=color_label)  
button2 = tkinter.Button(frame4, text="Configure button 2", command=color_label)

button3 = tkinter.Button(frame5, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
label2.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')  
button3.pack(fill='x')

root.mainloop()  

Output:

Okay, so now we have two labels and three buttons. Let's say we want "Configure button 1" to configure "Simple label 1" and "Configure button 2" to configure "Simple label 2" in the exact same way. Of course, the code above doesn't work this way – both buttons execute the color_label() function, which still only modifies one of the labels.

Probably the first solution that comes to your mind is modifying the color_label() function so that it takes a widget object as an argument and configures it. Then we could modify the button definition so that each of them passes its individual label in the command option:

# ...

def color_label(any_label):  
    any_label.configure(text="Changed label", bg="green", fg="white")

# ...

button1 = tkinter.Button(frame3, text="Configure button 1", command=color_label(label1))  
button2 = tkinter.Button(frame4, text="Configure button 2", command=color_label(label2))

# ...

Unfortunately, when we run this code, the color_label() function is executed, the moment the buttons are created, which is not a desirable outcome.

So how do we make it work properly?

Passing Arguments via Lambda Expressions

Lambda expressions offer a special syntax to create so-called anonymous functions, defined in a single line. Going into details about how lambdas work and when they are usually utilized is not the goal of this tutorial, so let's focus on our case, in which lambda expressions definitely come in handy.

import tkinter

root = tkinter.Tk()

def color_label(any_label):  
    any_label.configure(text="Changed label", bg="green", fg="white")

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame4 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame5 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=0, row=1, sticky="nsew")  
frame3.grid(column=1, row=0, sticky="nsew")  
frame4.grid(column=1, row=1, sticky="nsew")  
frame5.grid(column=0, row=2, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label 1")  
label2 = tkinter.Label(frame2, text="Simple label 2")  
button1 = tkinter.Button(frame3, text="Configure button 1", command=lambda: color_label(label1))  
button2 = tkinter.Button(frame4, text="Configure button 2", command=lambda: color_label(label2))

button3 = tkinter.Button(frame5, text="Apply and close", command=root.destroy)

label1.pack(fill='x')  
label2.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')  
button3.pack(fill='x')

root.mainloop()  

Output:

We modified the color_label() function the same way as we did in the previous shortened example. We made it accept an argument, which in this case can be any label (other widgets with text would work as well) and configured it by changing its text, text color, and background color.

The interesting part is lines 22 and 23. Here, we actually define two new lambda functions, that pass different arguments to the color_label() function and execute it. This way, we can avoid invoking the color_label() function the moment the buttons are initialized.

Getting User Input

We're getting closer to the end of the second article of our Tkinter tutorial series, so at this point, it would be good to show you a way of getting input from your program's user. To do so, the Entry widget can be useful. Look at the following script:

import tkinter

root = tkinter.Tk()

def color_label(any_label, user_input):  
    any_label.configure(text=user_input, bg="green", fg="white")

frame1 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame2 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame3 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame4 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame5 = tkinter.Frame(root, borderwidth=2, relief='ridge')  
frame6 = tkinter.Frame(root, borderwidth=2, relief='ridge')

frame1.grid(column=0, row=0, sticky="nsew")  
frame2.grid(column=0, row=1, sticky="nsew")  
frame3.grid(column=1, row=0, sticky="nsew")  
frame4.grid(column=1, row=1, sticky="nsew")  
frame5.grid(column=0, row=2, sticky="nsew", columnspan=2)  
frame6.grid(column=0, row=3, sticky="nsew", columnspan=2)

label1 = tkinter.Label(frame1, text="Simple label 1")  
label2 = tkinter.Label(frame2, text="Simple label 2")  
button1 = tkinter.Button(frame3, text="Configure button 1", command=lambda: color_label(label1, entry.get()))  
button2 = tkinter.Button(frame4, text="Configure button 2", command=lambda: color_label(label2, entry.get()))

button3 = tkinter.Button(frame5, text="Apply and close", command=root.destroy)

entry = tkinter.Entry(frame6)

label1.pack(fill='x')  
label2.pack(fill='x')  
button1.pack(fill='x')  
button2.pack(fill='x')  
button3.pack(fill='x')  
entry.pack(fill='x')

root.mainloop()  

Output:

Take a look at lines 5 and 6. As you can see, color_label() method accepts a new argument now. This argument – a string – is then used to modify the configured the label's text parameter. Additionally, in line 29 we create a new Entry widget (and in line 36 we pack it inside a new frame created in line 13).

In lines 24 and 25, we can see that each of our lambda functions also pass one additional argument. The get() method of the Entry class returns a string which is what the user typed into the entry field. So, as you probably already suspect, after clicking the "configure" buttons, the text of the labels assigned to them is changed to whatever text the user typed into our new entry field.

Conclusion

I hope this part of the tutorial filled some gaps in your understanding of the Tkinter module. Although some advanced features of Tkinter might seem a bit tricky at first, the general philosophy of building interfaces using the most popular GUI package for Python is very simple and intuitive.

Stay tuned for the last part of our Tkinter basics tutorial, where we'll discover some very clever shortcuts that let us create complex user interfaces with very limited code.

25 Oct 17:07

The death of consensus: how conflict came back to politics

New Labour’s ‘third way’ promised to end the clash between left and right. But did the fantasy of politics without strife create our age of anger? • Read the text version here
23 Oct 23:44

Collapse of ancient city’s water system may have led to its demise

by Jennifer Ouellette
Tom Roche

pullquote:

> Our cities are larger [and] more complex [than Angkor]—and our infrastructure is aging rapidly. This makes cities more vulnerable to the rippling effects brought on by climate change, most notably an increase in extreme weather events. "If we don't build resilience into our critical infrastructure, we may face severe and lasting disruptions to our civil systems, that can be intensified by external shocks and threaten our environment and economy," says [Mikhail] Prokopenko [@ U Sydney].

The Cambodian city of Angkor was once the largest in the world until vast swathes of the population decamped in the 15th century. Its famous temple, Angkor Wat (above), survived.

Enlarge / The Cambodian city of Angkor was once the largest in the world until vast swathes of the population decamped in the 15th century. Its famous temple, Angkor Wat (above), survived. (credit: Stefan Irvine/LightRocket/Getty Images)

The Cambodian city of Angkor was once the largest in the world... then the vast majority of its inhabitants suddenly decamped in the 15th century to a region near the modern city of Phnom Penh. Historians have put forth several theories about why this mass exodus occurred. A new paper in Science Advances argues that one major contributing factor was an overloaded water distribution system, exacerbated by extreme swings in the climate.

Angkor dates back to around 802 CE. Its vast network of canals, moats, embankments, and reservoirs developed over the next 600 years, helping distribute vital water resources for such uses as irrigation and to help control occasional flooding. By the end of the 11th century, the system bore all the features of a complex network, with thousands of interconnected individual components heavily dependent on each other.

Such a configuration, hovering at or near the so-called critical point, is ideal for the effective flow of resources, whether we're talking about water, electricity (power grids), traffic, the spread of disease, or information (the stock market and the Internet). The tradeoff is that it can become much more sensitive to even tiny perturbations—so much so that a small outage in one part of the network can trigger a sudden network-wide cascading failure.

Read 6 remaining paragraphs | Comments

23 Oct 23:35

Irreal: Virtualized Emacs

by jcs
Tom Roche

how to run Emacs on Windows 'even on locked down machines to which the developer doesn’t have administrative rights.' including automating the installation from scratch!

I’ve been happily Windows free for more than 20 years but it’s a sad fact that some of our brethren are forced, for reasons beyond their control, to work in the Windows environment. That’s hard on any Unix-head but especially so for Emacs users. It’s a sad fact that Emacs just doesn’t run very well on Windows and setting up the environment is harder than it should be.

Adrien Brochard recently gave a talk to the New York Emacs Meetup on his solution to this problem. He’s a Linux guy whose current job requires he work on a Windows machine. His answer is to Virtualize Emacs. What that means is that he runs Emacs on Arch Linux that in turn runs in a VirtualBox instance. As Brochard points out, this works even on locked down machines to which the developer doesn’t have administrative rights.

One of the nice things about this solution is how easy it is. Brochard has some scripts he uses to automate the installation of Linux and Emacs. During the presentation, he builds the entire environment, including VirtualBox, from scratch. It takes about 25 minutes but most of it is automated so that once he starts it, he can go on with his presentation. He says that even if you get something wrong you can simply blow away the VirtualBox instance and start over.

There is, of course, some overhead and Brochard does a good job on discussing that aspect too. All things considered, though, he believes that it’s the best solution for running Emacs on Windows.

The video is about 33 minutes so plan accordingly. It’s an excellent presentation and interesting even if you aren’t faced with running Emacs on Windows.

As a final note, I’ve discovered that I’m more partisan about editors than I thought. Back in 2016 I was outraged when someone did something similar to run Notepad++ under Ubuntu. In retrospect, it seems that it was the idea of using Notepad++ that outraged me not the use of a virtual environment to run it in.

23 Oct 23:33

Irreal: An Org Mode Workflow

by jcs
Tom Roche

pullquotes:
> how far he gets using just a few basic Org features

> one of the important lessons to take away from Badykov’s post is to start small.

Ayrat Badykov has an interesting post on his Org-mode workflow. In it he shows how he leverages Org mode to be more productive. What I find interesting—other than that I always find workflow articles interesting—is how far he gets using just a few basic Org features. He mostly uses just the list making and agenda functions of Org but still manages to organize his day. Doubtless, he’ll find, as many of us have, that his use of Org will grow organically (heh) and that he will start using more and more of its functionality.

If you’re a n00b, one of the important lessons to take away from Badykov’s post is to start small. Org has a lot of features, many of which are orthogonal to the others. You can make lists and schedule items with it. You can also write and publish papers with it. Or you can use it for literate programming or even to organize your Emacs configuration.

There’s too much there to learn all at once but you don’t need to. Learn a couple of its capabilities and integrate them into your workflow. You’ll find yourself thinking, “Gee, it would be nice if I could …,” check the manual and find that, in fact, Org can do that. Before long you’ll find yourself using a significant portion of Org’s functionality.

22 Oct 16:08

The Dig: Sawant on Socialism Against the Amazonification of Seattle

by Jacobin magazine
Tom Roche

excellent

Socialist Alternative's Kshama Sawant was elected to Seattle City Council way before socialism became a cool thing. Today, Dan's talking to Sawant about how socialists can build power and win at the local level—and how in Seattle, that means taking on Amazon, which recently coerced her colleagues on Council to reverse themselves on a big-business tax that was earmarked to help the homeless people who have been squeezed out of the housing market by an economy dominated by those very same big businesses.

 

Thanks to Verso Books. Check out their enormous catalogue of left-wing books at www.versobooks.com

Please support this podcast with money at Patreon.com/TheDig

20 Oct 18:26

Trump's Tax Schemes, Explained

Investigative reporters Susanne Craig and David Barstow say the president received today's equivalent of $413 million from his father's real estate empire, with the help of schemes to avoid paying taxes, including fraud.

Also, critic Ken Tucker reviews the album 'Desperate Man' by Eric Church.
20 Oct 16:40

Yglesias Strikes Out in Attacking John Judis "Nationalism"

Tom Roche

Very excellent, archived @ https://web.archive.org/web/20181020163930/http://cepr.net/blogs/beat-the-press/yglesias-strikes-out-in-attacking-john-judis-nationalism . Some pullquotes:

> I should also mention that I have not seen research that attempts to incorporate the impact of rents on real wages. Cities that have large inflows of immigrants (e.g. New York, Miami, and Los Angeles) have seen much sharper increases in rents than places like St. Louis and Cleveland. Given that the least-educated workers who face the brunt of the competition from immigrants may be spending 50 to 60 percent of their income on rent, this could be a very big deal. I don't know if this would change the story, but I have not seen analysis that attempts to incorporate the impact of differential rent increases.

later

> [US trade] policy has been very selective in what items we choose to open to trade. We don't have free trade across the board. We decided to make manufactured goods open to trade, which puts downward pressure on the wages of manufacturing workers, and thereby the non-college educated segment of the workforce. We have maintained or increased the protections for doctors and other highly paid professionals. This is not a problem of free trade, it is a problem of selective free trade that was designed to redistribute income upward.

ending on the economic consequences of granting Permanent Normal Trade Relations (PNTR) with China:

> Here also there were plenty of warnings, and as massive job loss in manufacturing was occurring in the years 2000 to 2007 (pre-crash), the Clintonite economists were almost completely silent. The best that can be said here is that they didn't care. It is inconceivable they would strike a trade deal that would do comparable harm to Citigroup and Goldman Sachs.

> Finally, Yglesias turns logic on its head when he writes:

> > "...the economic relationship with China also brought the United States very low borrowing costs in the 2000s that gave the federal government an enormous fiscal opportunity."

> The key point here is that the economic relationship with China (i.e. the trade deficit) gave us the enormous gap in demand that is now known as "secular stagnation." Of course, we could fill this gap with additional government spending in areas like education and infrastructure, but if we want to call this gap a gift, the collapse of the housing bubble and the Great Recession gave us an even larger gift of this type.

> Again, this is not wrong. A severe downturn frees up lots of resources that can be put to productive uses in principle, and so does a trade deficit. Unfortunately, we are just very bad in doing this, in large part because we have a cult of budget deficits being bad, with the Clintonite economists being leading promulgators.

I don't especially want to defend nationalism, given the folks who wave this flag these days, but Matt Yglesias gets a few things wrong in criticizing John Judis' NYT piece earlier this week.

To start with he quotes Judis:

"As long as corporations are free to roam the globe in search of lower wages and taxes, and as long as the United States opens its borders to millions of unskilled immigrants, liberals will not able to create bountiful, equitable societies, where people are free from basic anxieties about obtaining health care, education and housing.”

...and then tells us "this is flatly untrue."

Okay, let's take a step back. Is Yglesias really arguing that if we had open borders, so that literally hundreds of millions of people from the poorest countries on the planet could come to the US, that it would not mean a decline in living standards for the workers already here? That seems more than a bit far-fetched.

Of course, we did not have open borders, so the real question is did the levels of immigration we had prevent us from having a generous welfare state? Here Yglesias would be on solid ground in saying no. Most research indicates that immigration of the level we have seen has not hurt the wages of native-born workers, although it does depress the wages of earlier immigrants, making the catch-up process longer than it otherwise would be.

Read More ...

16 Oct 00:54

Bradley W. Hart, “Hitler’s American Friends: The Third Reich’s Supporters in the United States” (Thomas Dunne Books, 2018)

by Craig Sorvillo
Tom Roche

excellent interview

In his new book, Hitler’s American Friends: The Third Reich’s Supporters in the United States (Thomas Dunne Books, 2018), Bradley W. Hart, assistant professor at California State University, Fresno, examines Nazi sympathizers, noninterventionists, and others in American who advocated for Nazi Germany in the years before World War II.  Hart looks...
14 Oct 16:07

“Fixed mindsets” might be why we don’t understand statistics

by Jennifer Ouellette
Tom Roche

illustrates why one should calculate probabilities using "natural frequencies" rather than percentages

The wrongful conviction of Sally Clark for the murder of her two sons is a famous case of misuse of statistics in the courts.

Enlarge / The wrongful conviction of Sally Clark for the murder of her two sons is a famous case of misuse of statistics in the courts. (credit: Chris Young, PA Images/Getty Images)

In 1999, an English solicitor named Sally Clark went on trial for the murder of her two infant sons. She claimed both succumbed to sudden infant death syndrome. An expert witness for the prosecution, Sir Roy Meadow, argued that the odds of SIDS claiming two children from such an affluent family were 1 in 73 million, likening it to the odds of backing an 80-1 horse in the Grand National four years in a row and winning every time. The jury convicted Clark to life in prison.

But the Royal Statistical Society issued a statement after the verdict insisting that Meadow had erred in his calculation and that there was "no statistical basis" for his stated figure. Clark's conviction was overturned on appeal in January 2003, and the case has become a canonical example of the consequences of flawed statistical reasoning.

A new study in Frontiers in Psychology examined why people struggle so much to solve statistical problems, particularly why we show a marked preference for complicated solutions over simpler, more intuitive ones. Chalk it up to our resistance to change. The study concluded that fixed mindsets are to blame: we tend to stick with the familiar methods we learned in school, blinding us to the existence of a simpler solution.

Read 13 remaining paragraphs | Comments

10 Oct 13:54

David Stuttard, “Nemesis: Alcibiades and the Fall of Athens” (Harvard UP, 2018)

by Mark Klobas
Tom Roche

excellent biography, but author (literally) stutters

Among the many personages associated with the Peloponnesian War, none are as colorful as the Athenian general Alcibiades. In Nemesis: Alcibiades and the Fall of Athens (Harvard University Press, 2018), David Stuttard recounts the dramatic life of this controversial figure. A scion of a wealthy family, Alcibiades was adopted by...
09 Oct 17:14

Michael Lewis On 'The Fifth Risk'

Lewis, author of 'Moneyball' and 'The Big Short,' examines the energy, agriculture and commerce departments under President Trump. Lewis warns that half of the top 700 positions in the administration remain unfilled, and some of the people who have been appointed have conflicts of interest, or are unqualified, making them unprepared to deal with risks. "Many of them are potentially catastrophic risks — the risk of a pandemic, or the risk of a nuclear accident, or the risk of a terrorist attack — one after another. And many of these are not risks that most people are thinking about," Lewis says. His new book is 'The Fifth Risk.'
07 Oct 13:40

Finally, a cure for insomnia?

We are living through an epidemic of sleeplessness, but the medical establishment has largely ignored the problem. Can a radical new therapy help you get some sleep? Read the text version here
05 Oct 14:45

Behind the News, 10/4/18

Tom Roche

Shamus Khan on the culture of entitlement at elite schools (op-ed here) • Thea Riofrancos on the fraying legitimacy of the ruling class and its possibilities for the left

Behind the News, 10/4/18 - guests: Shamus Khan, Thea Riofrancos - Doug Henwood
01 Oct 13:11

A giant crawling brain: the jaw-dropping world of termites

At least half of termite studies used to be about how to kill them. But science is discovering their extraordinary usefulness Read the text version here
01 Oct 02:05

Neil Roberts, “A Political Companion to Frederick Douglass” (UP of Kentucky, 2018)

by Adam McNeil
Tom Roche

discusses almost everything except Douglass' political philosophy :-(

The year 2018 marks the 200th anniversary of Frederick Douglass’ birth. It can hardly be said that scholars have neglected Douglass; indeed, he is one of the most written-about figures in American history. But not all aspects of Douglass’ thought have received their due. One such blank spot in what...
30 Sep 17:22

Ken Ilguas, “This Land is Our Land: How We Lost the Right to Roam and How to Take It Back” (Plume, 2018)

by Ian J. Drake
Tom Roche

note author lastname is actually *Ilgunas* (vs misspelling in title)

Author, journalist and sometime park ranger Ken Ilgunas has written an argument in favor a “right to roam.”  This concept, unfamiliar to most Americans, is one of an ability to traverse public and private property for purposes of enjoying nature.  In This Land is Our Land: How We Lost the Right...
29 Sep 05:03

Scots and Catalans

Tom Roche

not as good as his NBN talk, though

Historian Sir John Elliott explores the long histories of Scottish and Catalan nationalism and considers some of the key similarities and differences between the two.

For information regarding your data privacy, visit acast.com/privacy
29 Sep 05:02

The Banya is Everything

by Sean
Tom Roche

excellent

Guest: Bryon MacWilliams on With Light Steam: A Personal Journey through the Russian Baths was published by Northern Illinois University Press. [spp-player]
29 Sep 05:02

Chinese Romance with the Russian Revolution

by Sean
Tom Roche

sounds almost cinematic

Guest: Elizabeth McGuire on Red at Heart: How Chinese Communists Fell in Love with the Russian Revolution published by Oxford University Press. [spp-player]
29 Sep 05:02

American-Russian Relations in the 19th Century

by Sean
Tom Roche

excellent

Guest: Norman Saul of US-Russian relations in the 19th Century
29 Sep 05:02

Nation, Nationality, and Empire

by Sean
Tom Roche

very excellent

Guest: Ronald Grigor Suny on nationality, nation, and empire in the Soviet Union.
28 Sep 13:41

Sunday Feature: A Life in Study: Robert Lowell

Tom Roche

> 2018-09-25 07:07:42 ERROR 403: Forbidden.
later fixed after complaint to BBC

Author Colm Toibin profiles the turbulent and brilliant life of American poet Robert Lowell, once considered the greatest living poet in English.

Four decades ago, the American poet Robert Lowell (1917-1977) died quietly in the back of a New York taxi. In his arms, he clutched a priceless portrait of his third wife, the Guinness heiress Lady Caroline Blackwood. Yet Lowell was on his way to see - and hopefully reconcile with - another woman: his beloved second wife, Elizabeth Hardwick. At the time of his passing, he had - almost unwittingly - embroiled both former wives in a scandal that had polarised the American literary community.

It was a strange, tragic end to what was one of the most brilliant careers in the history of 20th century letters. In his lifetime, Robert Lowell was arguably the most celebrated poet in America - not just a writer, but a major public figure: a "Boston Brahmin" whose ancestors had arrived on the Mayflower and helped found the American nation. Lowell's groundbreaking 1959 volume "Life Studies" had introduced a generation of readers to the idea of "confessional" poetry - stanzas that drew candidly from the poet's experience - and he was a teacher to Sylvia Plath, Anne Sexton and several other poetic giants. Erudite, charming and hugely personable, Lowell not only attracted a large and loyal circle of friends, but poured his vast intellectual powers into verses that were dense with historical allusion, dazzling linguistic turns and deep emotional insight. Everything - all of history, all of humanity - seems at Lowell's fingertips, and in his finest poems - among them "For The Union Dead", "Skunk Hour", "The Quaker Graveyard in Nantucket" and "Man and Wife" - he seems uniquely to be placing his own experience and history on a vast, almost unimaginable canvas of human history. In his pomp, his poems seemed to carry on the great, sweeping modernist tradition of TS Eliot, WH Auden and Ezra Pound.

Yet Lowell's vast literary and intellectual imagination carried with it deep personal cost. Lowell suffered for most of his life with what would now be thought of as bipolar disorder. Not only did his "manias" cause him to be repeatedly institutionalised, they irreparably fractured many of his relationships, hurt those closest to him, and scarred his ability to create. Only in recent times can we understand his behaviour as a hereditary mental illness - as part of the same great, difficult inheritance that brought him wealth, fame and privilege as a member of the American aristocracy.

Forty years on, Lowell's star has waned. His reputation seems no longer to be in the highest reaches of the poetic firmament: he's a writer who is more read-about than actually read. In 2017, is his poetry simply too difficult, too wilfully intellectual, too privileged, too white and male? Or does the secret of his decline lie in that murky scandal - a still-raw controversy about the limits of a poet's private and public worlds - one that still inflames passions today?

Written and presented by the writer Colm Toibin, in this documentary Robert Lowell's remarkable life and career is remembered and appraised by those closest to him, shedding new light on one of the giants of 20th century poetry.

Producer: Steven Rajam for BBC Wales