SHCreateDataObject/IDataObject Exhibits Strange Behavior During CDefView::OnBeginDrag - c++

In my IShellFolder::GetUIObjectOf with riid == IID_IDataObject, I invoke SHCreateDataObject and supply a pointer to my newly created DataObject as such:
DataObject *pDataObject = new DataObject (this->pidl_absolute, uCount, aPidl);
hr = SHCreateDataObject (this->pidl_absolute, uCount, aPidl, pDataObject, riid, ppvReturn);
DataObject::DataObject (PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, LPCITEMIDLIST aPidl[]) : reference_count (0)
{
++DLL_reference_count;
return; // DEFECT: For testing.
In my DataObject::DataObject constructor, I take care not to insert any FORMATETC or STGMEDIUM. Then I start a drag-and-drop operation from an Explorer CDefView window, causing the following call sequence. The drag-loop icon is mostly the "drop-effect-none" circle/slash with small [+] for some windows. For some strange reason, my DataObject::QueryGetData and DataObject::SetData are being invoked with weird arguments (with zero values that should not be zero?). Perhaps I do not understand. How could this be happening when it occurs before I have done anything that could trigger it (I think)? I wrote code to add CFSTR_FILEDESCRIPTORW and CFSTR_FILECONTENTS to my DataObject::DataObject constructor, which did not work, which lead me to this problem.
EDIT:
After a more thorough investigation, I can conclude that my problem is not SHCreateDataObject. I only invoke this function in one place in my code:
hr = SHCreateDataObject (this->pidl_absolute, uCount, aPidl, pDataObject, riid, ppvReturn);
After invocation, there is only one format present in pDataObject: CF_SHELLIDLIST. As #SimonMourier noted, there probably should be more. I manually insert the ones I need, which, ~technically~, I should be able to do, since my NSE is virtual. I can clearly see that during the DoDragDrop() loop, Explorer is invoking my SetData with CF_HDROP with pmedium->hGlobal nullified.
The circle/slash problem no longer exists, as it was due to a bogust ReleaseStgMedium, but the nullifed hGlobal is still present.
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = Shell IDList Array // tymed == TYMED_HGLOBAL for both
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = UsingDefaultDragImage // tymed == TYMED_HGLOBAL for both
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = DragImageBits // tymed == TYMED_HGLOBAL for both
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = DragContext // tymed == TYMED_ISTREAM for both
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = DragSourceHelperFlags // tymed == TYMED_HGLOBAL for both
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = InShellDragLoop // tymed == TYMED_HGLOBAL for both
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = DragContext// tymed == TYMED_ISTREAM
DataObject.cpp(550) : atlTraceGeneral - DataObject::QueryGetData : Format = CF_HDROP // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileName // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Net Resource // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileContents // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileGroupDescriptor // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileNameMapW // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileNameMapW // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC (again)
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Shell IDList Array // tymed == TYMED_HGLOBAL, I return S_OK
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = Shell IDList Array // tymed == TYMED_HGLOBAL for both, all other fields of *pmedium are 0!
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Shell Object Offsets // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = PrinterFriendlyName // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Shell IDLData Private // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = HTML Format // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileNameW // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = FileGroupDescriptorW // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Preferred DropEffect // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Performed DropEffect // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Paste Succeeded // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = UniformResourceLocator // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = InShellDragLoop // tymed == TYMED_HGLOBAL, I return S_OK
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = InShellDragLoop pformatetc->tymed == TYMED_HGLOBAL, *pmedium is ~ALL~ ZERO'S!!!, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = DragContext // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = TargetCLSID // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Embedded Object // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Object Descriptor // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = NotRecyclable // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Logical Performed DropEffect // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Briefcase File Object // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = DropEffectFolderList // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = Autoplay Enumerated IDList Array // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = UniformResourceLocator // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = UniformResourceLocatorW // cfformat == 0, tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(552) : atlTraceGeneral - DataObject::QueryGetData : Format = AsyncFlag // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
DataObject.cpp(608) : atlTraceGeneral - DataObject::EnumFormatEtc
DataObject.cpp(550) : atlTraceGeneral - DataObject::QueryGetData : Format = CF_HDROP // tymed == TYMED_HGLOBAL, I return DV_E_FORMATETC
The thread 0xfc8 has exited with code 0 (0x0).
The thread 0xfa0 has exited with code 0 (0x0).
Exception thrown at 0x000007FEFD11B87D (KernelBase.dll) in explorer.exe: 0x80010108: The object invoked has disconnected from its clients.
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = Shell IDList Array pformatetc->tymed == TYMED_HGLOBAL, *pmedium is ~ALL~ ZERO'S!!!, not sure what to do so I lie and return S_OK without doing anything.
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsShowingText
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = UsingDefaultDragImage
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DragSourceHelperFlags
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsComputingImage
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DisableDragText
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsComputingImage
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DropDescription
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DragContext
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsShowingLayered
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = UntrustedDragDrop
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = DropDescription
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = DisableDragText
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DisableDragText
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsComputingImage
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = DropDescription
DataObject.cpp(461) : atlTraceGeneral - DataObject::GetData : Format = IsShowingLayered
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = IsShowingLayered
DataObject.cpp(584) : atlTraceGeneral - DataObject::SetData : Format = IsShowingText
The following code shows that SHCreateDataObject injects only one FORMATETC for a filename. My guess is that format is CF_SHELLIDLIST.
#include <ole2.h>
#include <atlbase.h>
#include <Shobjidl.h>
#include <ShlObj.h>
#include <iostream>
using namespace std;
int main()
{
OleInitialize(NULL); // clipboard needs this
CComPtr<IShellItem> item;
SHCreateItemFromParsingName(L"C:\\Windows\\write.exe", NULL, IID_PPV_ARGS(&item));
CComHeapPtr<ITEMID_CHILD> child;
CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidl;
CComQIPtr<IParentAndItem>(item)->GetParentAndItem(&pidl, NULL, &child);
CComPtr<IDataObject> dao;
LPCITEMIDLIST list[1];
list[0] = child;
SHCreateDataObject(pidl, 1, list, NULL, IID_PPV_ARGS(&dao));
OleSetClipboard(dao);
IEnumFORMATETC* pEnumerator = 0;
dao->EnumFormatEtc(DATADIR_GET, &pEnumerator);
unsigned int i = 0;
FORMATETC formatec;
while (S_OK == pEnumerator->Next(1, &formatec, NULL))
++i;
cout << "The number of formats created is: " << i << endl; // ... This printed "1".
OleUninitialize();
return 0;
}

Related

elasticsearch-dsl-py query filter with term and range

I'm trying to filter a query with term and range along with query-string. filter(range) and query string works but not filter(term). am i doing something wrong?
es = Elasticsearch([{'host': '192.168.121.121', 'port': 9200}])
index = Index("filebeat-*",using=es)
search = index.search()
searchStr = "OutOfMemoryError"
search = search.query("query_string", query=searchStr)
search = search.filter('range' , **{'#timestamp': {'gte': 1589399137000 , 'lt': 1589399377000, 'format' : 'epoch_millis'}})
search = search.filter('term' , **{'can.deployment': 'can-*' })
response = search.execute(ignore_cache=True)
print(response.hits.total)
print(response.hits.hits._source.can.deployment)
json:
filter-term - ['hits']['hits']['_source']['can']['deployment']
filter-range- ['hits']['hits']['_source']['#timestamp']
{
"hits" : {
"total" : 138351328,
"max_score" : 6.5700893,
"hits" : [
{
"_index" : "filebeat-6.1.2-2020.05.13",
"_type" : "doc",
"_score" : 2.0166037,
"_source" : {
"#timestamp" : "2020-05-13T01:14:03.354Z",
"source" : "/var/log/gw_rest/gw_rest.log",
"message" : "[2020-05-13 01:14:03.354] WARN can_gw_rest [EventLoopGroup-3-2]: An exceptionCaught() event was fired.OutOfMemoryError,
"fileset" : {...},
"can" : {
"level" : "WARN",
>>>>>>>> "message" : "An exceptionCaught() event was fired- OutOfMemoryError,
"timestamp" : "2020-05-13 01:14:03.354",
>>>>>>>> "deployment" : "can-6b721b93965b-w3we4-4074-9903"
}
}
}
]
}
}
I actually didn't need a filter(term). this worked:
dIds=response['hits']['hits'][1]['_source']['can']['deployment']
print(dIds)
#loop through the response
for i in response['hits']['hits']:
id = i['_source']['can']['deployment']
print(id)

C++ writing to mongo, string fields not working in aggregation pipeline

**
Quick summary: C++ app loading data from SQL server using using OTL4, writing to Mongo using mongocxx bulk_write, the strings seem to getting mangled somehow so they don't work in the aggregation pipeline (but appear fine otherwise).
**
I have a simple Mongo collection which doesn't seem to behave as expected with an aggregation pipeline when I'm projecting multiple fields. It's a trivial document, no nesting, fields are just doubles and strings.
First 2 queries work as expected:
> db.TemporaryData.aggregate( [ { $project : { ParametersId:1 } } ] )
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "ParametersId" : 526988617 }
> db.TemporaryData.aggregate( [ { $project : { Col1:1 } } ] )
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "Col1" : 575 }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "Col1" : 579 }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "Col1" : 616 }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "Col1" : 617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "Col1" : 622 }
But then combining doesn't return both the fields as expected.
> db.TemporaryData.aggregate( [ { $project : { ParametersId:1, Col1:1 } } ] )
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "ParametersId" : 526988617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "ParametersId" : 526988617 }
It seems to be specific to the ParametersId field, for instance if I choose 2 other fields it's OK.
> db.TemporaryData.aggregate( [ { $project : { Col1:1, Col2:1 } } ] )
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "Col1" : 575, "Col2" : "1101-2" }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "Col1" : 579, "Col2" : "1103-2" }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "Col1" : 616, "Col2" : "1300-3" }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "Col1" : 617, "Col2" : "1300-3" }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "Col1" : 622, "Col2" : "1400-3" }
For some reason when I include ParametersId field, all hell breaks loose in the pipeline:
> db.TemporaryData.aggregate( [ { $project : { ParametersId:1, Col2:1, Col1:1, Col3:1 } } ] )
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "ParametersId" : 526988617, "Col1" : 575 }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "ParametersId" : 526988617, "Col1" : 579 }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "ParametersId" : 526988617, "Col1" : 616 }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "ParametersId" : 526988617, "Col1" : 617 }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "ParametersId" : 526988617, "Col1" : 622 }
DB version and the data:
> db.version()
4.0.2
> db.TemporaryData.find()
{ "_id" : ObjectId("5c28f751a531251fd0007c72"), "CellId" : 998909269, "ParametersId" : 526988617, "Order" : 1, "Col1" : 575, "Col2" : "1101-2", "Col3" : "CHF" }
{ "_id" : ObjectId("5c28f751a531251fd0007c73"), "CellId" : 998909269, "ParametersId" : 526988617, "Order" : 1, "Col1" : 579, "Col2" : "1103-2", "Col3" : "CHF" }
{ "_id" : ObjectId("5c28f751a531251fd0007c74"), "CellId" : 998909269, "ParametersId" : 526988617, "Order" : 1, "Col1" : 616, "Col2" : "1300-3", "Col3" : "CHF" }
{ "_id" : ObjectId("5c28f751a531251fd0007c75"), "CellId" : 998909269, "ParametersId" : 526988617, "Order" : 36, "Col1" : 617, "Col2" : "1300-3", "Col3" : "CHF" }
{ "_id" : ObjectId("5c28f751a531251fd0007c76"), "CellId" : 998909269, "ParametersId" : 526988617, "Order" : 1, "Col1" : 622, "Col2" : "1400-3", "Col3" : "CHF" }
Update: enquoting the field names makes no difference. I'm typing all the above in the mongo.exe command line, but I see the same behavior in my C++ application with a slightly more complex pipeline (projecting all fields to guarantee order).
This same app is actually creating the data in the first place - does anyone know anything which can go wrong? All using the mongocxx lib.
** update **
Turns out there's something going wrong with my handling of strings. Without the string fields in the data, it's all fine. So I've knackered my strings, somehow, even though they look and behave correctly in other ways they don't play nice with the aggregation pipeline. I'm using mongocxx::collection.bulk_write to write standard std::strings which are being loaded from sql server through the OTL4 header. In-between there's a strncpy_s when they get stored internally. I can't seem to create a simple reproducible example.
Just to be safe that there is no conflict with anything else, try using the projection with a strict formatted json: (add quotes to keys)
db.TemporaryData.aggregate( [ { $project : { "ParametersId":1, "Col1":1 } } ] )
Finally found the issue was corrupt documents, which because I was using bulk_write for the insert were getting into the database but causing this strange behavior. I switched to using insert_many, which threw up the document was corrupt, and then I could track down the bug.
The docs were corrupt because I was writing the same field-value data multiple times, which seems to be break the bsoncxx::builder::stream::document I was using to construct them.

Pyomo, Exiting pyomo solve: Multiple models defined in file:

Working on my first pyomo lp and I am having trouble when I go to load the data. The model appears to be fine but then when it goes to solve it returns that all of my variables are stale and will not give me any values. I have some ideas but wanted to get some more to see if someone else could point out what I am doing wrong. Below is the model
from pyomo.environ import *
import pandas as pd
import numpy as np
from pyomo.core import *
opt = AbstractModel()
opt.PC = Set()
opt.DC = Set()
opt.costs =Param(opt.PC,opt.DC, within = NonNegativeReals)
opt.demands=Param(opt.DC, within = NonNegativeIntegers)
opt.supply= Param(opt.PC, within = NonNegativeIntegers)
opt.cases = Var(opt.PC,opt.DC,domain = NonNegativeIntegers)
def constraint1(opt,DC):
return sum(
opt.cases[i,DC]
for i in opt.PC
) == opt.demands[DC]
opt.constraintdemand = Constraint(opt.DC,rule = constraint1)
def constraint2(opt,PC):
return sum(
opt.cases[PC,j]
for j in opt.DC
) <= opt.supply[PC]
opt.constraintsupply = Constraint(opt.PC,rule = constraint2)
def ObjectiveFunction(opt):
return sum(
opt.costs[i,j] * opt.cases[i,j]
for i in opt.PC
for j in opt.DC
)
opt.Obj=Objective(rule=ObjectiveFunction)
data = DataPortal()
data.load(filename='lp.dat', set = opt.PC)
data.load(filename ='lp.dat', set = opt.DC)
data.load(filename='lp.dat', param = opt.costs)
data.load(filename='lp.dat', param = opt.demands)
data.load(filename='lp.dat', param = opt.supply)
instance = opt.create_instance(data)
instance.pprint()
Here are are the variable declarations:
1 Var Declarations
cases : Size=288, Index=cases_index
Key : Lower : Value : Upper : Fixed : Stale : Domain
(1, 1) : 0 : None : None : False : True : NonNegativeIntegers
(1, 2) : 0 : None : None : False : True : NonNegativeIntegers
(1, 3) : 0 : None : None : False : True : NonNegativeIntegers
(1, 4) : 0 : None : None : False : True : NonNegativeIntegers
(1, 5) : 0 : None : None : False : True : NonNegativeIntegers
(1, 6) : 0 : None : None : False : True : NonNegativeIntegers
(1, 7) : 0 : None : None : False : True : NonNegativeIntegers
(1, 8) : 0 : None : None : False : True : NonNegativeIntegers
(1, 9) : 0 : None : None : False : True : NonNegativeIntegers
(1, 10) : 0 : None : None : False : True : NonNegativeIntegers
(1, 11) : 0 : None : None : False : True : NonNegativeIntegers
(1, 12) : 0 : None : None : False : True : NonNegativeIntegers
(1, 13) : 0 : None : None : False : True : NonNegativeIntegers
(1, 14) : 0 : None : None : False : True : NonNegativeIntegers
(1, 15) : 0 : None : None : False : True : NonNegativeIntegers
(1, 16) : 0 : None : None : False : True : NonNegativeIntegers
(1, 17) : 0 : None : None : False : True : NonNegativeIntegers
(1, 18) : 0 : None : None : False : True : NonNegativeIntegers
(1, 19) : 0 : None : None : False : True : NonNegativeIntegers
(1, 20) : 0 : None : None : False : True : NonNegativeIntegers
(1, 21) : 0 : None : None : False : True : NonNegativeIntegers
(1, 22) : 0 : None : None : False : True : NonNegativeIntegers
(1, 23) : 0 : None : None : False : True : NonNegativeIntegers
(1, 24) : 0 : None : None : False : True : NonNegativeIntegers
(1, 25) : 0 : None : None : False : True : NonNegativeIntegers
(1, 26) : 0 : None : None : False : True : NonNegativeIntegers
(1, 27) : 0 : None : None : False : True : NonNegativeIntegers
(1, 28) : 0 : None : None : False : True : NonNegativeIntegers
(1, 29) : 0 : None : None : False : True : NonNegativeIntegers
(1, 30) : 0 : None : None : False : True : NonNegativeIntegers
(1, 31) : 0 : None : None : False : True : NonNegativeIntegers
(1, 32) : 0 : None : None : False : True : NonNegativeIntegers
(1, 33) : 0 : None : None : False : True : NonNegativeIntegers
(1, 34) : 0 : None : None : False : True : NonNegativeIntegers
(1, 35) : 0 : None : None : False : True : NonNegativeIntegers
(1, 36) : 0 : None : None : False : True : NonNegativeIntegers
(1, 37) : 0 : None : None : False : True : NonNegativeIntegers
(1, 38) : 0 : None : None : False : True : NonNegativeIntegers
(1, 39) : 0 : None : None : False : True : NonNegativeIntegers
(1, 40) : 0 : None : None : False : True : NonNegativeIntegers
(1, 41) : 0 : None : None : False : True : NonNegativeIntegers
(1, 42) : 0 : None : None : False : True : NonNegativeIntegers
(1, 43) : 0 : None : None : False : True : NonNegativeIntegers
(1, 44) : 0 : None : None : False : True : NonNegativeIntegers
(1, 45) : 0 : None : None : False : True : NonNegativeIntegers
(1, 46) : 0 : None : None : False : True : NonNegativeIntegers
(1, 47) : 0 : None : None : False : True : NonNegativeIntegers
(1, 48) : 0 : None : None : False : True : NonNegativeIntegers
(1, 49) : 0 : None : None : False : True : NonNegativeIntegers
(1, 50) : 0 : None : None : False : True : NonNegativeIntegers
(1, 51) : 0 : None : None : False : True : NonNegativeIntegers
(1, 52) : 0 : None : None : False : True : NonNegativeIntegers
(1, 53) : 0 : None : None : False : True : NonNegativeIntegers
(1, 54) : 0 : None : None : False : True : NonNegativeIntegers
(1, 55) : 0 : None : None : False : True : NonNegativeIntegers
(1, 56) : 0 : None : None : False : True : NonNegativeIntegers
(1, 57) : 0 : None : None : False : True : NonNegativeIntegers
(1, 58) : 0 : None : None : False : True : NonNegativeIntegers
(1, 59) : 0 : None : None : False : True : NonNegativeIntegers
(1, 60) : 0 : None : None : False : True : NonNegativeIntegers
(1, 61) : 0 : None : None : False : True : NonNegativeIntegers
(1, 62) : 0 : None : None : False : True : NonNegativeIntegers
(1, 63) : 0 : None : None : False : True : NonNegativeIntegers
(1, 64) : 0 : None : None : False : True : NonNegativeIntegers
(1, 65) : 0 : None : None : False : True : NonNegativeIntegers
(1, 66) : 0 : None : None : False : True : NonNegativeIntegers
(1, 67) : 0 : None : None : False : True : NonNegativeIntegers
(1, 68) : 0 : None : None : False : True : NonNegativeIntegers
(1, 69) : 0 : None : None : False : True : NonNegativeIntegers
(1, 70) : 0 : None : None : False : True : NonNegativeIntegers
(1, 71) : 0 : None : None : False : True : NonNegativeIntegers
(1, 72) : 0 : None : None : False : True : NonNegativeIntegers
(1, 73) : 0 : None : None : False : True : NonNegativeIntegers
(1, 74) : 0 : None : None : False : True : NonNegativeIntegers
(1, 75) : 0 : None : None : False : True : NonNegativeIntegers
(1, 76) : 0 : None : None : False : True : NonNegativeIntegers
(1, 77) : 0 : None : None : False : True : NonNegativeIntegers
(1, 78) : 0 : None : None : False : True : NonNegativeIntegers
(1, 79) : 0 : None : None : False : True : NonNegativeIntegers
(1, 80) : 0 : None : None : False : True : NonNegativeIntegers
(1, 81) : 0 : None : None : False : True : NonNegativeIntegers
(1, 82) : 0 : None : None : False : True : NonNegativeIntegers
(1, 83) : 0 : None : None : False : True : NonNegativeIntegers
(1, 84) : 0 : None : None : False : True : NonNegativeIntegers
(1, 85) : 0 : None : None : False : True : NonNegativeIntegers
(1, 86) : 0 : None : None : False : True : NonNegativeIntegers
(1, 87) : 0 : None : None : False : True : NonNegativeIntegers
(1, 88) : 0 : None : None : False : True : NonNegativeIntegers
(1, 89) : 0 : None : None : False : True : NonNegativeIntegers
(1, 90) : 0 : None : None : False : True : NonNegativeIntegers
(1, 91) : 0 : None : None : False : True : NonNegativeIntegers
(1, 92) : 0 : None : None : False : True : NonNegativeIntegers
(1, 93) : 0 : None : None : False : True : NonNegativeIntegers
(1, 94) : 0 : None : None : False : True : NonNegativeIntegers
(1, 95) : 0 : None : None : False : True : NonNegativeIntegers
(1, 96) : 0 : None : None : False : True : NonNegativeIntegers
(1, 97) : 0 : None : None : False : True : NonNegativeIntegers
(1, 98) : 0 : None : None : False : True : NonNegativeIntegers
(1, 99) : 0 : None : None : False : True : NonNegativeIntegers
(1, 100) : 0 : None : None : False : True : NonNegativeIntegers
(1, 101) : 0 : None : None : False : True : NonNegativeIntegers
(1, 102) : 0 : None : None : False : True : NonNegativeIntegers
(1, 103) : 0 : None : None : False : True : NonNegativeIntegers
(1, 104) : 0 : None : None : False : True : NonNegativeIntegers
(1, 105) : 0 : None : None : False : True : NonNegativeIntegers
(1, 106) : 0 : None : None : False : True : NonNegativeIntegers
(1, 107) : 0 : None : None : False : True : NonNegativeIntegers
(1, 108) : 0 : None : None : False : True : NonNegativeIntegers
(1, 109) : 0 : None : None : False : True : NonNegativeIntegers
(1, 110) : 0 : None : None : False : True : NonNegativeIntegers
(1, 111) : 0 : None : None : False : True : NonNegativeIntegers
(1, 112) : 0 : None : None : False : True : NonNegativeIntegers
(1, 113) : 0 : None : None : False : True : NonNegativeIntegers
(1, 114) : 0 : None : None : False : True : NonNegativeIntegers
(1, 115) : 0 : None : None : False : True : NonNegativeIntegers
(1, 116) : 0 : None : None : False : True : NonNegativeIntegers
(1, 117) : 0 : None : None : False : True : NonNegativeIntegers
(1, 118) : 0 : None : None : False : True : NonNegativeIntegers
(1, 119) : 0 : None : None : False : True : NonNegativeIntegers
(1, 120) : 0 : None : None : False : True : NonNegativeIntegers
(1, 121) : 0 : None : None : False : True : NonNegativeIntegers
(1, 122) : 0 : None : None : False : True : NonNegativeIntegers
(1, 123) : 0 : None : None : False : True : NonNegativeIntegers
(1, 124) : 0 : None : None : False : True : NonNegativeIntegers
(1, 125) : 0 : None : None : False : True : NonNegativeIntegers
(1, 126) : 0 : None : None : False : True : NonNegativeIntegers
(1, 127) : 0 : None : None : False : True : NonNegativeIntegers
(1, 128) : 0 : None : None : False : True : NonNegativeIntegers
(1, 129) : 0 : None : None : False : True : NonNegativeIntegers
(1, 130) : 0 : None : None : False : True : NonNegativeIntegers
(1, 131) : 0 : None : None : False : True : NonNegativeIntegers
(1, 132) : 0 : None : None : False : True : NonNegativeIntegers
(1, 133) : 0 : None : None : False : True : NonNegativeIntegers
(1, 134) : 0 : None : None : False : True : NonNegativeIntegers
(1, 135) : 0 : None : None : False : True : NonNegativeIntegers
(1, 136) : 0 : None : None : False : True : NonNegativeIntegers
(1, 137) : 0 : None : None : False : True : NonNegativeIntegers
(1, 138) : 0 : None : None : False : True : NonNegativeIntegers
(1, 139) : 0 : None : None : False : True : NonNegativeIntegers
(1, 140) : 0 : None : None : False : True : NonNegativeIntegers
(1, 141) : 0 : None : None : False : True : NonNegativeIntegers
(1, 142) : 0 : None : None : False : True : NonNegativeIntegers
(1, 143) : 0 : None : None : False : True : NonNegativeIntegers
(1, 144) : 0 : None : None : False : True : NonNegativeIntegers
(2, 1) : 0 : None : None : False : True : NonNegativeIntegers
(2, 2) : 0 : None : None : False : True : NonNegativeIntegers
(2, 3) : 0 : None : None : False : True : NonNegativeIntegers
(2, 4) : 0 : None : None : False : True : NonNegativeIntegers
(2, 5) : 0 : None : None : False : True : NonNegativeIntegers
(2, 6) : 0 : None : None : False : True : NonNegativeIntegers
(2, 7) : 0 : None : None : False : True : NonNegativeIntegers
(2, 8) : 0 : None : None : False : True : NonNegativeIntegers
(2, 9) : 0 : None : None : False : True : NonNegativeIntegers
(2, 10) : 0 : None : None : False : True : NonNegativeIntegers
(2, 11) : 0 : None : None : False : True : NonNegativeIntegers
(2, 12) : 0 : None : None : False : True : NonNegativeIntegers
(2, 13) : 0 : None : None : False : True : NonNegativeIntegers
(2, 14) : 0 : None : None : False : True : NonNegativeIntegers
(2, 15) : 0 : None : None : False : True : NonNegativeIntegers
(2, 16) : 0 : None : None : False : True : NonNegativeIntegers
(2, 17) : 0 : None : None : False : True : NonNegativeIntegers
(2, 18) : 0 : None : None : False : True : NonNegativeIntegers
(2, 19) : 0 : None : None : False : True : NonNegativeIntegers
(2, 20) : 0 : None : None : False : True : NonNegativeIntegers
(2, 21) : 0 : None : None : False : True : NonNegativeIntegers
(2, 22) : 0 : None : None : False : True : NonNegativeIntegers
(2, 23) : 0 : None : None : False : True : NonNegativeIntegers
(2, 24) : 0 : None : None : False : True : NonNegativeIntegers
(2, 25) : 0 : None : None : False : True : NonNegativeIntegers
(2, 26) : 0 : None : None : False : True : NonNegativeIntegers
(2, 27) : 0 : None : None : False : True : NonNegativeIntegers
(2, 28) : 0 : None : None : False : True : NonNegativeIntegers
(2, 29) : 0 : None : None : False : True : NonNegativeIntegers
(2, 30) : 0 : None : None : False : True : NonNegativeIntegers
(2, 31) : 0 : None : None : False : True : NonNegativeIntegers
(2, 32) : 0 : None : None : False : True : NonNegativeIntegers
(2, 33) : 0 : None : None : False : True : NonNegativeIntegers
(2, 34) : 0 : None : None : False : True : NonNegativeIntegers
(2, 35) : 0 : None : None : False : True : NonNegativeIntegers
(2, 36) : 0 : None : None : False : True : NonNegativeIntegers
(2, 37) : 0 : None : None : False : True : NonNegativeIntegers
(2, 38) : 0 : None : None : False : True : NonNegativeIntegers
(2, 39) : 0 : None : None : False : True : NonNegativeIntegers
(2, 40) : 0 : None : None : False : True : NonNegativeIntegers
(2, 41) : 0 : None : None : False : True : NonNegativeIntegers
(2, 42) : 0 : None : None : False : True : NonNegativeIntegers
(2, 43) : 0 : None : None : False : True : NonNegativeIntegers
(2, 44) : 0 : None : None : False : True : NonNegativeIntegers
(2, 45) : 0 : None : None : False : True : NonNegativeIntegers
(2, 46) : 0 : None : None : False : True : NonNegativeIntegers
(2, 47) : 0 : None : None : False : True : NonNegativeIntegers
(2, 48) : 0 : None : None : False : True : NonNegativeIntegers
(2, 49) : 0 : None : None : False : True : NonNegativeIntegers
(2, 50) : 0 : None : None : False : True : NonNegativeIntegers
(2, 51) : 0 : None : None : False : True : NonNegativeIntegers
(2, 52) : 0 : None : None : False : True : NonNegativeIntegers
(2, 53) : 0 : None : None : False : True : NonNegativeIntegers
(2, 54) : 0 : None : None : False : True : NonNegativeIntegers
(2, 55) : 0 : None : None : False : True : NonNegativeIntegers
(2, 56) : 0 : None : None : False : True : NonNegativeIntegers
(2, 57) : 0 : None : None : False : True : NonNegativeIntegers
(2, 58) : 0 : None : None : False : True : NonNegativeIntegers
(2, 59) : 0 : None : None : False : True : NonNegativeIntegers
(2, 60) : 0 : None : None : False : True : NonNegativeIntegers
(2, 61) : 0 : None : None : False : True : NonNegativeIntegers
(2, 62) : 0 : None : None : False : True : NonNegativeIntegers
(2, 63) : 0 : None : None : False : True : NonNegativeIntegers
(2, 64) : 0 : None : None : False : True : NonNegativeIntegers
(2, 65) : 0 : None : None : False : True : NonNegativeIntegers
(2, 66) : 0 : None : None : False : True : NonNegativeIntegers
(2, 67) : 0 : None : None : False : True : NonNegativeIntegers
(2, 68) : 0 : None : None : False : True : NonNegativeIntegers
(2, 69) : 0 : None : None : False : True : NonNegativeIntegers
(2, 70) : 0 : None : None : False : True : NonNegativeIntegers
(2, 71) : 0 : None : None : False : True : NonNegativeIntegers
(2, 72) : 0 : None : None : False : True : NonNegativeIntegers
(2, 73) : 0 : None : None : False : True : NonNegativeIntegers
(2, 74) : 0 : None : None : False : True : NonNegativeIntegers
(2, 75) : 0 : None : None : False : True : NonNegativeIntegers
(2, 76) : 0 : None : None : False : True : NonNegativeIntegers
(2, 77) : 0 : None : None : False : True : NonNegativeIntegers
(2, 78) : 0 : None : None : False : True : NonNegativeIntegers
(2, 79) : 0 : None : None : False : True : NonNegativeIntegers
(2, 80) : 0 : None : None : False : True : NonNegativeIntegers
(2, 81) : 0 : None : None : False : True : NonNegativeIntegers
(2, 82) : 0 : None : None : False : True : NonNegativeIntegers
(2, 83) : 0 : None : None : False : True : NonNegativeIntegers
(2, 84) : 0 : None : None : False : True : NonNegativeIntegers
(2, 85) : 0 : None : None : False : True : NonNegativeIntegers
(2, 86) : 0 : None : None : False : True : NonNegativeIntegers
(2, 87) : 0 : None : None : False : True : NonNegativeIntegers
(2, 88) : 0 : None : None : False : True : NonNegativeIntegers
(2, 89) : 0 : None : None : False : True : NonNegativeIntegers
(2, 90) : 0 : None : None : False : True : NonNegativeIntegers
(2, 91) : 0 : None : None : False : True : NonNegativeIntegers
(2, 92) : 0 : None : None : False : True : NonNegativeIntegers
(2, 93) : 0 : None : None : False : True : NonNegativeIntegers
(2, 94) : 0 : None : None : False : True : NonNegativeIntegers
(2, 95) : 0 : None : None : False : True : NonNegativeIntegers
(2, 96) : 0 : None : None : False : True : NonNegativeIntegers
(2, 97) : 0 : None : None : False : True : NonNegativeIntegers
(2, 98) : 0 : None : None : False : True : NonNegativeIntegers
(2, 99) : 0 : None : None : False : True : NonNegativeIntegers
(2, 100) : 0 : None : None : False : True : NonNegativeIntegers
(2, 101) : 0 : None : None : False : True : NonNegativeIntegers
(2, 102) : 0 : None : None : False : True : NonNegativeIntegers
(2, 103) : 0 : None : None : False : True : NonNegativeIntegers
(2, 104) : 0 : None : None : False : True : NonNegativeIntegers
(2, 105) : 0 : None : None : False : True : NonNegativeIntegers
(2, 106) : 0 : None : None : False : True : NonNegativeIntegers
(2, 107) : 0 : None : None : False : True : NonNegativeIntegers
(2, 108) : 0 : None : None : False : True : NonNegativeIntegers
(2, 109) : 0 : None : None : False : True : NonNegativeIntegers
(2, 110) : 0 : None : None : False : True : NonNegativeIntegers
(2, 111) : 0 : None : None : False : True : NonNegativeIntegers
(2, 112) : 0 : None : None : False : True : NonNegativeIntegers
(2, 113) : 0 : None : None : False : True : NonNegativeIntegers
(2, 114) : 0 : None : None : False : True : NonNegativeIntegers
(2, 115) : 0 : None : None : False : True : NonNegativeIntegers
(2, 116) : 0 : None : None : False : True : NonNegativeIntegers
(2, 117) : 0 : None : None : False : True : NonNegativeIntegers
(2, 118) : 0 : None : None : False : True : NonNegativeIntegers
(2, 119) : 0 : None : None : False : True : NonNegativeIntegers
(2, 120) : 0 : None : None : False : True : NonNegativeIntegers
(2, 121) : 0 : None : None : False : True : NonNegativeIntegers
(2, 122) : 0 : None : None : False : True : NonNegativeIntegers
(2, 123) : 0 : None : None : False : True : NonNegativeIntegers
(2, 124) : 0 : None : None : False : True : NonNegativeIntegers
(2, 125) : 0 : None : None : False : True : NonNegativeIntegers
(2, 126) : 0 : None : None : False : True : NonNegativeIntegers
(2, 127) : 0 : None : None : False : True : NonNegativeIntegers
(2, 128) : 0 : None : None : False : True : NonNegativeIntegers
(2, 129) : 0 : None : None : False : True : NonNegativeIntegers
(2, 130) : 0 : None : None : False : True : NonNegativeIntegers
(2, 131) : 0 : None : None : False : True : NonNegativeIntegers
(2, 132) : 0 : None : None : False : True : NonNegativeIntegers
(2, 133) : 0 : None : None : False : True : NonNegativeIntegers
(2, 134) : 0 : None : None : False : True : NonNegativeIntegers
(2, 135) : 0 : None : None : False : True : NonNegativeIntegers
(2, 136) : 0 : None : None : False : True : NonNegativeIntegers
(2, 137) : 0 : None : None : False : True : NonNegativeIntegers
(2, 138) : 0 : None : None : False : True : NonNegativeIntegers
(2, 139) : 0 : None : None : False : True : NonNegativeIntegers
(2, 140) : 0 : None : None : False : True : NonNegativeIntegers
(2, 141) : 0 : None : None : False : True : NonNegativeIntegers
(2, 142) : 0 : None : None : False : True : NonNegativeIntegers
(2, 143) : 0 : None : None : False : True : NonNegativeIntegers
(2, 144) : 0 : None : None : False : True : NonNegativeIntegers
The problem is that you were combining two ways of solving Pyomo models that aren't compatible. If you start with an abstract model you can solve it by:
In a Python script use a DataPortal to create a concrete model instance and then solve that model by using the SolverFactory to call a solver
Use the pyomo command and pass in the Python script defining the abstract model and a .dat file with the data to instantiate the model

How to make a game over sequence for tic tac toe when there are no winners?

I would like to display a label that says game over when there are no winners. I just thought to make an else statement but once there is one click game over would be display since the elif statements are false. Any ideas.
from tkinter import*
#Window stuff
window = Tk()
window.title("Tic Tac Toe")
window.configure(background = "black")
window.geometry("400x400")
#Variables
global clickable
playerXturn = True
ticker = 0
#Display X or O
def buttonClicked(c) :
global playerXturn
if playerXturn == True :
buttonList[c]["image"] = picX
buttonList[c]["state"] = DISABLED
playerXturn = False
labelTurn ["text"] = "O's turn"
elif clickable[c] == "" :
buttonList[c]["image"] = picO
buttonList[c]["state"] = DISABLED
playerXturn = True
labelTurn ["text"] = "X's turn"
#Info for user
global ticker
ticker += 1
if ticker == 500 :
labelInfo["text"] = "Timed Out"
labelInfo["bg"] = "red"
#Three in a row
elif (button1["image"] == str(picX) and button2["image"] == str(picX) and button3["image"] == str(picX) or
button4["image"] == str(picX) and button5["image"] == str(picX) and button6["image"] == str(picX) or
button7["image"] == str(picX) and button8["image"] == str(picX) and button9["image"] == str(picX) or
button1["image"] == str(picX) and button4["image"] == str(picX) and button7["image"] == str(picX) or
button2["image"] == str(picX) and button5["image"] == str(picX) and button8["image"] == str(picX) or
button3["image"] == str(picX) and button6["image"] == str(picX) and button9["image"] == str(picX) or
button1["image"] == str(picX) and button5["image"] == str(picX) and button9["image"] == str(picX) or
button3["image"] == str(picX) and button5["image"] == str(picX) and button7["image"] == str(picX)) :
#print ("X")
labelInfo["text"] = "X Wins"
labelInfo["bg"] = "red"
button1["state"] = DISABLED
button2["state"] = DISABLED
button3["state"] = DISABLED
button4["state"] = DISABLED
button5["state"] = DISABLED
button6["state"] = DISABLED
button7["state"] = DISABLED
button8["state"] = DISABLED
button9["state"] = DISABLED
labelTurn ["bg"] = "black"
elif (button1["image"] == str(picO) and button2["image"] == str(picO) and button3["image"] == str(picO) or
button4["image"] == str(picO) and button5["image"] == str(picO) and button6["image"] == str(picO) or
button7["image"] == str(picO) and button8["image"] == str(picO) and button9["image"] == str(picO) or
button1["image"] == str(picO) and button4["image"] == str(picO) and button7["image"] == str(picO) or
button2["image"] == str(picO) and button5["image"] == str(picO) and button8["image"] == str(picO) or
button3["image"] == str(picO) and button6["image"] == str(picO) and button9["image"] == str(picO) or
button1["image"] == str(picO) and button5["image"] == str(picO) and button9["image"] == str(picO) or
button3["image"] == str(picO) and button5["image"] == str(picO) and button7["image"] == str(picO)) :
#print("O")
labelInfo["text"] = "O Wins"
labelInfo["bg"] = "red"
button1["state"] = DISABLED
button2["state"] = DISABLED
button3["state"] = DISABLED
button4["state"] = DISABLED
button5["state"] = DISABLED
button6["state"] = DISABLED
button7["state"] = DISABLED
button8["state"] = DISABLED
button9["state"] = DISABLED
labelTurn ["bg"] = "black"
#Images
picX = PhotoImage (file = "x.gif")
picO = PhotoImage (file = "o.gif")
picBlank = PhotoImage (file = "sw.gif")
#Buttons
button1 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(0))
button1.grid (row = 0, column = 0)
#button1["state"] = DISABLED
button2 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(1))
button2.grid (row = 0, column = 1)
#button2["state"] = DISABLED
button3 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(2))
button3.grid (row = 0, column = 2)
#button3["state"] = DISABLED
button4 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(3))
button4.grid (row = 1, column = 0)
#button4["state"] = DISABLED
button5 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(4))
button5.grid (row = 1, column = 1)
#button5["state"] = DISABLED
button6 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(5))
button6.grid (row= 1, column = 2)
#button6["state"] = DISABLED
button7 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(6))
button7.grid (row = 2, column = 0)
#button7["state"] = DISABLED
button8 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(7))
button8.grid (row = 2, column = 1)
#button8["state"] = DISABLED
button9 = Button (window, text = "", image = picBlank, command = lambda: buttonClicked(8))
button9.grid (row = 2, column = 2)
#button9["state"] = DISABLED
#Lists
buttonList = [button1, button2, button3, button4, button5, button6, button7, button8, button9]
clickable = ["", "", "", "", "", "", "", "", ""]
#Reset
def processReset():
button1["state"] = NORMAL
button2["state"] = NORMAL
button3["state"] = NORMAL
button4["state"] = NORMAL
button5["state"] = NORMAL
button6["state"] = NORMAL
button7["state"] = NORMAL
button8["state"] = NORMAL
button9["state"] = NORMAL
button1["image"] = picBlank
button2["image"] = picBlank
button3["image"] = picBlank
button4["image"] = picBlank
button5["image"] = picBlank
button6["image"] = picBlank
button7["image"] = picBlank
button8["image"] = picBlank
button9["image"] = picBlank
labelTurn["bg"] = "white"
labelInfo["text"] = "Continue Playing"
labelInfo["bg"] = "white"
#Extra labels and buttons
labelMenu = Label (window, text = "Menu and Info", height = 2, width = 24, bg = "yellow")
labelMenu.grid (row = 4, column = 4)
labelTurn = Label (window, text = "X goes first", height = 2, width = 10)
labelTurn.grid (row = 6, column = 4)
labelInfo = Label (window, text = "Continue Playing", height = 2, width = 14)
labelInfo.grid (row = 5, column = 4)
buttonReset = Button(window, text = "Reset/New Game", bg = "Orange", command = processReset)
buttonReset.grid (row = 7, column = 4)
labelNote = Label (window, text = "Note: Losing player goes first next game", bg = "Pink")
labelNote.grid (row = 8, column = 4)
window.mainloop()
You want an elif statement at the end of your else-if chain that checks whether there's any empty spaces left. If there's no spaces left, and a winner wasn't declared by one of the statements before this one, it's necessarily a tie.
Something like:
elif (check that no empty board spaces remain) :
#print("-")
labelInfo["text"] = "It's a tie!"

How to add collection name in the output of map reduce job to get all the keys in the collection with collection name .my code is like

var allCollections = db.getCollectionNames();
for (var i = 0; i < allCollections.length; ++i) {
var collectioname = allCollections[i];
if (collectioname === 'system.indexes')
continue;
db.runCommand(
{ "mapreduce" : collectioname, "map" : function()
{
for (var key in this) {
emit(key, null);
}
}, "reduce" : function(key, stuff) {
return null;
}, "out":mongo_test + "_keys"
}) }
output
{ "_id" : "_id", "value" : null }
{ "_id" : "collection_name", "value" : null }
{ "_id" : "database", "value" : null }
{ "_id" : "host", "value" : null }
{ "_id" : "port", "value" : null }
{ "_id" : "cardid", "value" : null }
{ "_id" : "ccard", "value" : null }
{ "_id" : "creditcardnum", "value" : null }
{ "_id" : "date", "value" : null }
{ "_id" : "value", "value" : null }
I want collectionname in the "value" field instead of null .