我正在使用Mac上的Python IDLE编辑器,但由于某些原因,现在每次我点击IDLE图标时,它会在文档中弹出一秒钟然后它就会消失。 IDLE不再运行了。
在我在网上找到的一条建议中,它说要输入public class MainActivity2 extends Activity implements
OnItemClickListener {
int shop_len;
String[] chennai,mumbai,calcutta;
String[] desc_chennai,desc_mumbai,desc_calcutta;
ListView listView2;
List<Item2> rowItems2;
Button button;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
String city = getIntent().getExtras().getString("CNAME");
chennai = getResources().getStringArray(R.array.area_chennai);
mumbai = getResources().getStringArray(R.array.area_mumbai);
calcutta = getResources().getStringArray(R.array.area_calcutta);
shop_len=getResources().getStringArray(R.array.area_shop).length;
desc_chennai = new String[]{String.valueOf(shop_len),String.valueOf(shop_len),String.valueOf(shop_len)};
desc_mumbai = new String[]{String.valueOf(shop_len),String.valueOf(shop_len),String.valueOf(shop_len),String.valueOf(shop_len)};
TextView cityname = (TextView) findViewById(R.id.name);
cityname.setText("City: "+city);
if (city.equals("Chennai")) {
rowItems2 = new ArrayList<Item2>();
for (int i = 0; i < chennai.length; i++) {
Item2 item = new Item2(chennai[i], desc_chennai[i]);
rowItems2.add(item);
}
listView2 = (ListView) findViewById(R.id.list2);
CustomListViewAdapter2 adapter2 = new CustomListViewAdapter2(this,
R.layout.list_item2, rowItems2);
listView2.setAdapter(adapter2);
listView2.setOnItemClickListener(this);
}else if(city.equals("Mumbai")){
rowItems2 = new ArrayList<Item2>();
for (int i = 0; i < mumbai.length; i++) {
Item2 item = new Item2(mumbai[i], desc_mumbai[i]);
rowItems2.add(item);
}
listView2 = (ListView) findViewById(R.id.list2);
CustomListViewAdapter2 adapter2 = new CustomListViewAdapter2(this,
R.layout.list_item2, rowItems2);
listView2.setAdapter(adapter2);
listView2.setOnItemClickListener(this);
}else if(city.equals("Calcutta")){
rowItems2 = new ArrayList<Item2>();
for (int i = 0; i < mumbai.length; i++) {
Item2 item = new Item2(mumbai[i], desc_mumbai[i]);
rowItems2.add(item);
}
listView2 = (ListView) findViewById(R.id.list2);
CustomListViewAdapter2 adapter2 = new CustomListViewAdapter2(this,
R.layout.list_item2, rowItems2);
listView2.setAdapter(adapter2);
listView2.setOnItemClickListener(this);
}
button = (Button) findViewById(R.id.filterbutton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// Start NewActivity.class
Intent myIntent = new Intent(MainActivity2.this,
FilterActivity.class);
startActivity(myIntent);
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
}
});
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
}
,我在控制台中输入它,它启动了Python shell,我可以从中打开一个新文件并开始编码。
但是,我想避免这样做,并且能够使用应用程序文件夹中的图标启动IDLE。
我已经下载并安装了Homebrew,Pandas,PyCharm等等,因为我已经看到了一些关于安装它们的建议而没有完全理解它们。我想知道这些程序中是否有任何程序改变了IDLE导致它崩溃的东西?
这适用于Mac OS上的Python 3.6。