Python 3 -- minesweeper -- clear empty squares?...

from tkinter import *
from tkinter import ttk
from random import sample
setWidth = 10
setHeight = 10
numberOfMines = 10
def createBoard(sWidth, sHeight):
for y in range(0, sHeight):
for x in range(0, sWidth):
# border images -- setHeight and setWidth have 1 subtracted (set*-1),
# so that they are placed correctly...
if x == 0 and y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgTL)
elif x == 0 and y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgBL)
elif x == sWidth-1 and y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgTR)
elif x == sWidth-1 and y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgBR)
elif x == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgL)
elif x == sWidth-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgR)
elif y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgT)
elif y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgB)
# main squares covering mines
else:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=SqImgU, activeimage=SqImgA, disabledimage=SqImg0)
def generateMines(sWidth, sHeight, numMines):
mineList = sample((fieldCanvas.find_enclosed(25, 25, (sWidth-1)*25, (sHeight-1)*25)), numMines)
for mine in mineList:
fieldCanvas.itemconfigure(mine, tag='mine')
def bindSquares(sWidth, sHeight):
for square in fieldCanvas.find_enclosed(25, 25, (sWidth-1)*25, (sHeight-1)*25):
fieldCanvas.tag_bind(square, '<Enter>', squareCheck())
def squareReveal(event):
sqImgResult = squareCheck(event)
sWidth = setWidth*25
sHeight = setHeight*25
if event.x in range(25, sWidth*25) and event.y in range(25, sHeight*25):
fieldCanvas.itemconfigure((fieldCanvas.find_closest(event.x, event.y)), state=DISABLED, disabledimage=sqImgResult)
def squareCheck(event):
# sqID is the ID of the object clicked on.
sqID = int((fieldCanvas.find_closest(event.x, event.y))[0])
#***IF SELECTED SQUARE IS A MINE***
if 'mine' in fieldCanvas.gettags(sqID):
sqImgResult = SqImgM
return sqImgResult
#***IF SELECTED SQUARE HAS MINES ADJACENT TO IT***
s = setWidth
surroundingSquares = []
surroundingSquares.extend([sqID, sqID-s-1, sqID-s, sqID-s+1, sqID+1, sqID+s+1, sqID+s, sqID+s-1, sqID-1])
surroundingTags = []
for square in surroundingSquares:
surroundingTags.append(fieldCanvas.gettags(square))
surroundingMineCount = 0
for tags in surroundingTags:
if 'mine' in tags:
surroundingMineCount += 1
if surroundingMineCount > 0:
variableDict = {
'SqImg1': SqImg1,
'SqImg2': SqImg2,
'SqImg3': SqImg3,
'SqImg4': SqImg4,
'SqImg5': SqImg5,
'SqImg6': SqImg6,
'SqImg7': SqImg7,
'SqImg8': SqImg8
sqImgResult = variableDict['SqImg%s' % (surroundingMineCount)]
return sqImgResult
#***IF SELECTED SQUARE HAS NO ADJACENT MINES***
else:
#need to clear surrounding squares....
sqImgResult = SqImg0
return sqImgResult
root = Tk()
root.title('SnakeSweeper')
fieldFrame = ttk.Frame(root, padding='0')
fieldFrame.grid(column=0, row=2, sticky='nesw')
SqImgU = PhotoImage(file='SqImgU.gif')
SqImgA = PhotoImage(file='SqImgA.gif')
SqImgM = PhotoImage(file='SqImgM.gif')
SqImg0 = PhotoImage(file='SqImg0.gif')
SqImg1 = PhotoImage(file='SqImg1.gif')
SqImg2 = PhotoImage(file='SqImg2.gif')
SqImg3 = PhotoImage(file='SqImg3.gif')
SqImg4 = PhotoImage(file='SqImg4.gif')
SqImg5 = PhotoImage(file='SqImg5.gif')
SqImg6 = PhotoImage(file='SqImg6.gif')
SqImg7 = PhotoImage(file='SqImg7.gif')
SqImg8 = PhotoImage(file='SqImg8.gif')
# BdrImg's are numbered clockwise starting from the top left.
BdrImgT = PhotoImage(file='BdrImgT.gif')
BdrImgR = PhotoImage(file='BdrImgR.gif')
BdrImgB = PhotoImage(file='BdrImgB.gif')
BdrImgL = PhotoImage(file='BdrImgL.gif')
BdrImgTR = PhotoImage(file='BdrImgTR.gif')
BdrImgBR = PhotoImage(file='BdrImgBR.gif')
BdrImgBL = PhotoImage(file='BdrImgBL.gif')
BdrImgTL = PhotoImage(file='BdrImgTL.gif')
fieldCanvas = Canvas(fieldFrame, width=(setWidth*25), height=(setHeight*25))
fieldCanvas.grid(column=0, row=0, sticky='nesw')
createBoard(setWidth, setHeight)
#bindSquares(setWidth, setHeight)
generateMines(setWidth, setHeight, numberOfMines)
fieldCanvas.tag_bind(CURRENT, '<Button-1>', squareReveal)
root.mainloop()
lacking most features, but! im doing pretty good so far.  code has NOT been cleaned, so lots of useless characters/repetition... and like i said, many features are missing, so there are placeholders for testing (setWidth, numberOfMines, etc.)
i've run into a slight major problem .  how would i go about automatically clearing empty mine squares after one (empty one) has been clicked?  i can make it clear the ones adjacent, but i need it to clear in all directions as far as possible... any ideas?  i assume i'll need some sort of an 'until' function...?
btw if you wanted to see it   border images unfinished.  pretty snazzy for tk.
Last edited by jtkiv (2011-03-25 20:46:44)

##SnakeSweeper in the works.
##Thomas Kirkpatrick (jtkiv)
from tkinter import *
from tkinter import ttk
from random import sample
##TMP variables as placeholders for non-existent functions/controls...
setWidth = 10
setHeight = 10
numberOfMines = 10
##functions! :(
##create the board thing.
def createBoard(sWidth, sHeight):
for y in range(0, sHeight):
for x in range(0, sWidth):
# border images -- setHeight and setWidth have 1 subtracted (set*-1),
# so that they are placed correctly...
if x == 0 and y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgTL)
elif x == 0 and y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgBL)
elif x == sWidth-1 and y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgTR)
elif x == sWidth-1 and y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgBR)
elif x == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgL)
elif x == sWidth-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgR)
elif y == 0:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgT)
elif y == sHeight-1:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=BdrImgB)
# main squares covering mines
else:
fieldCanvas.create_image(x*25, y*25, anchor=NW, image=SqImgU, activeimage=SqImgA, disabledimage=SqImg0)
##randomly place mines in the board. they are tagged with >> 'mine' (creative i know)
def generateMines(sWidth, sHeight, numMines):
mineList = sample((fieldCanvas.find_enclosed(25, 25, (sWidth-1)*25, (sHeight-1)*25)), numMines)
for mine in mineList:
fieldCanvas.itemconfigure(mine, tag='mine')
##these functions mark the beginning of the 'game loop'...
##or whatever you want to call it. the process should be:
##.-->what was clicked? > was it a mine? YES> game over
##| NO> how many mines adjacent? (1-8)> set SqImg[x]
##| (0)> set SqImg0 > whats around the squares that are around it? -.
#this is the function that sets the images for clicked squares.
def squareClear(squareID, mineCount):
variableDict = {
'SqImgM': SqImgM,
'SqImg0': SqImg0,
'SqImg1': SqImg1,
'SqImg2': SqImg2,
'SqImg3': SqImg3,
'SqImg4': SqImg4,
'SqImg5': SqImg5,
'SqImg6': SqImg6,
'SqImg7': SqImg7,
'SqImg8': SqImg8
sqImgResult = variableDict['SqImg%s' % (mineCount)]
fieldCanvas.itemconfigure(squareID, state=DISABLED, disabledimage=sqImgResult)
#answers the question: "what was clicked?"
def squareClicked(event):
sWidth = setWidth*25
sHeight = setHeight*25
#another question: "is it on the board?"
if event.x in range(25, sWidth-25) and event.y in range(25, sHeight-25):
#ok, checks out... now: "what is it's ID?" and direct it!
squareDirect(int((fieldCanvas.find_closest(event.x, event.y))[0]))
#answers the question: "was the clicked square a mine?"
def squareDirect(squareID):
#yep! it was a mine!
if 'mine' in fieldCanvas.gettags(squareID):
print('this beast was a mine!')
#code for end-game will go here later...
#replace the square with a 'mine' image...
squareClear(squareID, 'M')
#no way!!! why would i click a mine?!?
else:
print('no mine here... taking', squareID, 'to squareCheck')
squareCheck(squareID)
#first part of the question: "*how* *many* mines *adjacent?*"
# 'ID' is the same number as squareID, just shorter to type...
def surroundingCollect(ID):
surroundingCollection = []
w = setWidth
h = setHeight
#some squareIDs will be off the board or part of the border, and therefore
#invalid. so "validIDs" stores a list of all valid squareIDs...
validIDs = []
for x in range(2, w):
for i in range(1, (w-1)):
y = h*i
validIDs.append(x+y)
#let's find the IDs of the surrounding squares...
expectedLocations = [ID-w-1, ID-w, ID-w+1, ID+1, ID+w+1, ID+w, ID+w-1, ID-1]
for location in expectedLocations:
#let's also only accept valid locations...
if location in validIDs:
surroundingCollection.append(location)
return surroundingCollection
#with info from "surroundingCollect", answers the question: "how many mines adjacent?"
def squareCheck(squareID):
s = setWidth
surroundingSquares = surroundingCollect(squareID)
print(surroundingSquares, 'made it to surroundingSquares in squareCheck')
surroundingMineCount = 0
for square in surroundingSquares:
if 'mine' in fieldCanvas.gettags(square):
surroundingMineCount += 1
print(surroundingMineCount, 'made it out of for loop in squareCheck')
if surroundingMineCount == 0:
print('headed to squareClear (0) with', squareID, surroundingMineCount)
squareClear(squareID, '0')
print('headed to emptySquares with', surroundingSquares)
emptySquares(surroundingSquares)
else:
print('headed to squareClear with', squareID, surroundingMineCount)
squareClear(squareID, surroundingMineCount)
#if there are no mines adjacent, this function is here to help.
#answers question: "what's around the squares around me?"
def emptySquares(surroundingSquares):
print('made it to surroundingSquares with', surroundingSquares)
for square in surroundingSquares:
print('taking', square, 'to squareDirect!!!')
squareDirect(square)
#gui code...
root = Tk()
root.title('SnakeSweeper')
fieldFrame = ttk.Frame(root, padding='0')
fieldFrame.grid(column=0, row=2, sticky='nesw')
SqImgU = PhotoImage(file='SqImgU.gif')
SqImgA = PhotoImage(file='SqImgA.gif')
SqImgM = PhotoImage(file='SqImgM.gif')
SqImg0 = PhotoImage(file='SqImg0.gif')
SqImg1 = PhotoImage(file='SqImg1.gif')
SqImg2 = PhotoImage(file='SqImg2.gif')
SqImg3 = PhotoImage(file='SqImg3.gif')
SqImg4 = PhotoImage(file='SqImg4.gif')
SqImg5 = PhotoImage(file='SqImg5.gif')
SqImg6 = PhotoImage(file='SqImg6.gif')
SqImg7 = PhotoImage(file='SqImg7.gif')
SqImg8 = PhotoImage(file='SqImg8.gif')
# BdrImg's are numbered clockwise starting from the top left.
BdrImgT = PhotoImage(file='BdrImgT.gif')
BdrImgR = PhotoImage(file='BdrImgR.gif')
BdrImgB = PhotoImage(file='BdrImgB.gif')
BdrImgL = PhotoImage(file='BdrImgL.gif')
BdrImgTR = PhotoImage(file='BdrImgTR.gif')
BdrImgBR = PhotoImage(file='BdrImgBR.gif')
BdrImgBL = PhotoImage(file='BdrImgBL.gif')
BdrImgTL = PhotoImage(file='BdrImgTL.gif')
fieldCanvas = Canvas(fieldFrame, width=(setWidth*25), height=(setHeight*25))
fieldCanvas.grid(column=0, row=0, sticky='nesw')
createBoard(setWidth, setHeight)
generateMines(setWidth, setHeight, numberOfMines)
fieldCanvas.tag_bind(CURRENT, '<Button-1>', squareClicked)
root.mainloop()
shell...
no mine here... taking 12 to squareCheck
[13, 23, 22] made it to surroundingSquares in squareCheck
1 made it out of for loop in squareCheck
headed to squareClear with 12 1
no mine here... taking 13 to squareCheck
[14, 24, 23, 22, 12] made it to surroundingSquares in squareCheck
1 made it out of for loop in squareCheck
headed to squareClear with 13 1
no mine here... taking 14 to squareCheck
[15, 25, 24, 23, 13] made it to surroundingSquares in squareCheck
1 made it out of for loop in squareCheck
headed to squareClear with 14 1
no mine here... taking 15 to squareCheck
[16, 26, 25, 24, 14] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
# the first empty square to be clicked...
headed to squareClear (0) with 15 0
headed to emptySquares with [16, 26, 25, 24, 14]
made it to surroundingSquares with [16, 26, 25, 24, 14]
taking 16 to squareDirect!!!
no mine here... taking 16 to squareCheck
[17, 27, 26, 25, 15] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 16 0
headed to emptySquares with [17, 27, 26, 25, 15]
made it to surroundingSquares with [17, 27, 26, 25, 15]
taking 17 to squareDirect!!!
no mine here... taking 17 to squareCheck
[18, 28, 27, 26, 16] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 17 0
headed to emptySquares with [18, 28, 27, 26, 16]
made it to surroundingSquares with [18, 28, 27, 26, 16]
taking 18 to squareDirect!!!
no mine here... taking 18 to squareCheck
[19, 29, 28, 27, 17] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 18 0
headed to emptySquares with [19, 29, 28, 27, 17]
made it to surroundingSquares with [19, 29, 28, 27, 17]
taking 19 to squareDirect!!!
no mine here... taking 19 to squareCheck
[29, 28, 18] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 19 0
headed to emptySquares with [29, 28, 18]
made it to surroundingSquares with [29, 28, 18]
taking 29 to squareDirect!!!
no mine here... taking 29 to squareCheck
[18, 19, 39, 38, 28] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 29 2
taking 28 to squareDirect!!!
no mine here... taking 28 to squareCheck
[17, 18, 19, 29, 39, 38, 37, 27] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 28 2
taking 18 to squareDirect!!!
no mine here... taking 18 to squareCheck
[19, 29, 28, 27, 17] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 18 0
headed to emptySquares with [19, 29, 28, 27, 17]
made it to surroundingSquares with [19, 29, 28, 27, 17]
taking 19 to squareDirect!!!
no mine here... taking 19 to squareCheck
[29, 28, 18] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 19 0
headed to emptySquares with [29, 28, 18]
made it to surroundingSquares with [29, 28, 18]
taking 29 to squareDirect!!!
no mine here... taking 29 to squareCheck
[18, 19, 39, 38, 28] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 29 2
taking 28 to squareDirect!!!
no mine here... taking 28 to squareCheck
[17, 18, 19, 29, 39, 38, 37, 27] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 28 2
taking 18 to squareDirect!!!
no mine here... taking 18 to squareCheck
[19, 29, 28, 27, 17] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 18 0
headed to emptySquares with [19, 29, 28, 27, 17]
made it to surroundingSquares with [19, 29, 28, 27, 17]
taking 19 to squareDirect!!!
no mine here... taking 19 to squareCheck
[29, 28, 18] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 19 0
headed to emptySquares with [29, 28, 18]
made it to surroundingSquares with [29, 28, 18]
taking 29 to squareDirect!!!
no mine here... taking 29 to squareCheck
[18, 19, 39, 38, 28] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 29 2
taking 28 to squareDirect!!!
no mine here... taking 28 to squareCheck
[17, 18, 19, 29, 39, 38, 37, 27] made it to surroundingSquares in squareCheck
2 made it out of for loop in squareCheck
headed to squareClear with 28 2
taking 18 to squareDirect!!!
no mine here... taking 18 to squareCheck
[19, 29, 28, 27, 17] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 18 0
headed to emptySquares with [19, 29, 28, 27, 17]
made it to surroundingSquares with [19, 29, 28, 27, 17]
taking 19 to squareDirect!!!
no mine here... taking 19 to squareCheck
[29, 28, 18] made it to surroundingSquares in squareCheck
0 made it out of for loop in squareCheck
headed to squareClear (0) with 19 0
headed to emptySquares with
#TERMINATED HERE
so even with the reorganized code (which is much faster), i'm still not getting it to work.  i know its going to do lots of calculations, but good lands, there's only 100 possible squares (in this setup).
and even in 100, it still go in circles forever unless i tell it not to check what has already been checked.  probably the problem...
any ideas?

Similar Messages

  • My New Tab Page does not work at all. I just have the empty squares with nothing in them at all?

    My New Tab Page does not work at all. I just have the empty squares with nothing in them at all?
    I know how to use about:config & have had the usual problems with newtab page tiles but this is more like a bug- using 33.0.1. Doesn't show tiles icon in top right corner just shows a gear that is used to hide the empty tiles that I can't fill with sites. First it would only show 2 rows of 4 columns even though I had it set to 5 & 6 then few days later for no reason they went empty with a serrated line around the tiles & can't drag from the bookmarks---- really bloody annoying!!!!!!! Possibly a setting in the about:config but i can't fig it out?

    Reset Firefox to its default state
    If you're having major problems which you can't resolve, start fresh with only your essential information.
    Troubleshooting Information
    This page contains technical information that might be useful when you're trying to solve a problem. If you are looking for answers to common questions about Firefox, check out our support website.
    Application Basics
    Name Firefox
    Version 33.0.1
    Update History
    User Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
    Profile Folder
    Enabled Plugins about:plugins
    Build Configuration about:buildconfig
    Memory Use about:memory
    Multiprocess Windows 0/1
    Crash Reports for the Last 3 Days
    Report ID Submitted
    All Crash Reports
    Extensions
    Name Version Enabled ID
    Adblock Plus 2.6.5 true {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
    Adblock Plus Pop-up Addon 0.9.2 true [email protected]
    Skype Click to Call 7.3.16540.9015 true {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}
    Trend Micro BEP Firefox Extension 8.0.0.1173 true [email protected]
    Trend Micro NSC Firefox Extension 6.8.0.1120 true {22C7F6C6-8D67-4534-92B5-529A0EC09405}
    Trend Micro Toolbar 7.0.0.1243 true {22181a4d-af90-4ca3-a569-faed9118d6bc}
    Graphics
    Adapter Description Intel(R) HD Graphics
    Adapter Drivers igdumd64 igd10umd64 igdumdx32 igd10umd32
    Adapter RAM Unknown
    Device ID 0x0046
    Direct2D Enabled true
    DirectWrite Enabled true (6.2.9200.16571)
    Driver Date 1-30-2013
    Driver Version 8.15.10.2993
    GPU #2 Active false
    GPU Accelerated Windows 1/1 Direct3D 11 (OMTC)
    Vendor ID 0x8086
    WebGL Renderer Google Inc. -- ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)
    windowLayerManagerRemote true
    AzureCanvasBackend direct2d
    AzureContentBackend direct2d
    AzureFallbackCanvasBackend cairo
    AzureSkiaAccelerated 0
    Important Modified Preferences
    Name Value accessibility.blockautorefresh true
    accessibility.typeaheadfind.flashBar 0
    browser.cache.disk.capacity 358400
    browser.cache.disk.smart_size_cached_value 358400
    browser.cache.disk.smart_size.first_run false
    browser.cache.disk.smart_size.use_old_max false
    browser.cache.frecency_experiment 1
    browser.places.smartBookmarksVersion 7
    browser.sessionstore.upgradeBackup.latestBuildID 20141023194920
    browser.startup.homepage www.google.com
    browser.startup.homepage_override.buildID 20141023194920
    browser.startup.homepage_override.mstone 33.0.1
    browser.tabs.loadInBackground false
    dom.mozApps.used true
    extensions.lastAppVersion 33.0.1
    font.internaluseonly.changed true
    gfx.direct3d.last_used_feature_level_idx 1
    keyword.URL http://www.bing.com/search?FORM=UP97DF&PC=UP97&q=
    media.gmp-gmpopenh264.lastUpdate 1413750166
    media.gmp-gmpopenh264.version 1.1
    media.gmp-manager.lastCheck 1414375733
    network.cookie.prefsMigrated true
    places.database.lastMaintenance 1414404204
    places.history.expiration.transient_current_max_pages 102059
    plugin.disable_full_page_plugin_for_types application/pdf
    plugin.importedState true
    plugin.state.npmedia 0
    plugin.state.nptimegrid 1
    print.printer_Canon_MG2100_series_Printer.print_bgcolor false
    print.printer_Canon_MG2100_series_Printer.print_bgimages false
    print.printer_Canon_MG2100_series_Printer.print_colorspace
    print.printer_Canon_MG2100_series_Printer.print_command
    print.printer_Canon_MG2100_series_Printer.print_downloadfonts false
    print.printer_Canon_MG2100_series_Printer.print_duplex 3997817
    print.printer_Canon_MG2100_series_Printer.print_edge_bottom 0
    print.printer_Canon_MG2100_series_Printer.print_edge_left 0
    print.printer_Canon_MG2100_series_Printer.print_edge_right 0
    print.printer_Canon_MG2100_series_Printer.print_edge_top 0
    print.printer_Canon_MG2100_series_Printer.print_evenpages true
    print.printer_Canon_MG2100_series_Printer.print_footercenter
    print.printer_Canon_MG2100_series_Printer.print_footerleft &PT
    print.printer_Canon_MG2100_series_Printer.print_footerright &D
    print.printer_Canon_MG2100_series_Printer.print_headercenter
    print.printer_Canon_MG2100_series_Printer.print_headerleft &T
    print.printer_Canon_MG2100_series_Printer.print_headerright &U
    print.printer_Canon_MG2100_series_Printer.print_in_color true
    print.printer_Canon_MG2100_series_Printer.print_margin_bottom 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_left 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_right 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_top 0.5
    print.printer_Canon_MG2100_series_Printer.print_oddpages true
    print.printer_Canon_MG2100_series_Printer.print_orientation 0
    print.printer_Canon_MG2100_series_Printer.print_page_delay 50
    print.printer_Canon_MG2100_series_Printer.print_paper_data 1
    print.printer_Canon_MG2100_series_Printer.print_paper_height 11.00
    print.printer_Canon_MG2100_series_Printer.print_paper_name
    print.printer_Canon_MG2100_series_Printer.print_paper_size_type 0
    print.printer_Canon_MG2100_series_Printer.print_paper_size_unit 0
    print.printer_Canon_MG2100_series_Printer.print_paper_width 8.50
    print.printer_Canon_MG2100_series_Printer.print_plex_name
    print.printer_Canon_MG2100_series_Printer.print_resolution 7602290
    print.printer_Canon_MG2100_series_Printer.print_resolution_name
    print.printer_Canon_MG2100_series_Printer.print_reversed false
    print.printer_Canon_MG2100_series_Printer.print_scaling 1.00
    print.printer_Canon_MG2100_series_Printer.print_shrink_to_fit true
    print.printer_Canon_MG2100_series_Printer.print_to_file false
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_bottom 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_left 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_right 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_top 0
    privacy.sanitize.migrateFx3Prefs true
    privacy.sanitize.timeSpan 2
    storage.vacuum.last.index 1
    storage.vacuum.last.places.sqlite 1412311800
    Important Locked Preferences
    Name Value
    JavaScript
    Incremental GC true
    Accessibility
    Activated false
    Prevent Accessibility 0
    Library Versions
    Expected minimum version Version in use
    NSPR 4.10.7 4.10.7
    NSS 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSSMIME 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSSSL 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSUTIL 3.17.1 3.17.1
    Experimental Features
    Name ID Description Active End Date Homepage

  • I am using the Adobe Acrobat Reader on a mac and I followed all the directions to copy an image but when I press paste only half of the image appears or it appears as an empty square. What can I do to fix this?

    I am using the Adobe Acrobat Reader on a mac and I followed all the directions to copy an image but when I press paste only half of the image appears or it appears as an empty square. What can I do to fix this?

    Hello,
    I would like to inform you that not all the browsers and online PDF readers support copying text from a PDF. If you have opened the PDF online, please download PDF file to your computer and then open the file in Adobe Reader.
    Please share a screenshot if the issue still persists.
    Regards,
    Nakul

  • How do I get custom icon for favorites on my tool bar instead of a empty square

    I am trying to add an Image to a book marked page on my favorites toolbar that has a empty square and do not seem to be able to do this .I keep trying add ons but they are only allowing common icons .I know that I have been able to create buttons easily in the past but can not do so now .I tried several add ons that say just right click and i have looked at customize tool bar .I am missing somethig what is it ?

    ''Be patient, most of us are volunteers.''
    That webpage doesn't have a Favicon image.
    Come up with an image that you want and pick an extension [https://addons.mozilla.org/en-US/firefox/search/?q=Favicon&appver=15.0.1&platform=windows that inserts a Favicon or changes the Favicon].

  • Arabic characters appear as empty squares when using certain HTML tags or font styles

    Only when HW acceleration is on. Arabic characters appear as empty squares when using "italic" or "oblique" font styles or when using &lt;i&gt; or &lt;em&gt; html tags.
    Try this code to replicate the problem
    <pre>
    &lt;p&gt;مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;p style="font-style: italic;">Italic مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;p style="font-style: oblique;">Oblique مشكلة ظهور المربعات الخالية بدل الحروف&lt;/p&gt;
    &lt;i&gt;i tag مشكلة ظهور المربعات الخالية بدل الحروف</i> &lt;br&gt; &lt;br&gt;
    &lt;em&gt;em tag مشكلة ظهور المربعات الخالية بدل الحروف &lt;/em&gt;
    </pre>

    After lots of research, I found the problem. The boxes (squares) show up whenever there is a font in the webpage that does not have Arabic within its Unicode range such as Times New Roman Italic or Oblique. Normally, Firefox will pick another font to display the characters but now, a newly introduced feature is interfering.
    To fix the problem without turning off hardware acceleration.
    Go to about:config
    locate: gfx.font_rendering.directwrite.use_gdi_table_loading
    which is True by default in FF4.0 Beta 10, and change it to False.
    This is a bug that has to be fixed.

  • When I go into photos or events under library I can not see my photos, only empty squares.  I rebuilt iphoto by holding down option-command keys

    When I go in photos or events under library in iphoto I can not see pictures, all it shows is the empty squares. The fotos r there cause when I scroll down with the mouse I can see the pictures for a few seconds. I rebuild iphoto by holding down option-command keys and then iphoto ican.  need help please

    Hi,
    You have managed to post in Applications then iChat within that.
    iPhoto is listed under iLife
    I have not used iPhoto enough to be  able to offer solution for you.
    You would be better off posting in the iPhoto Forum (in that link above)
    7:40 PM      Monday; May 2, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.7)
    , Mac OS X (10.6.7),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Clear/empty entry of field after validation pattern message

    Can anyone help me please with the following:
    Now when user fills a field a validation pattern message shows when entry is not according to validation. BUT...the entry remains.
    Do you know how to remove the entry from the field after clicking OK on the validation pattern message box?

    I don't know how to do that, but I think it would be user abuse to clear out the field. If I mistype a date or an SSN for example, I don't want to have to type it all over again, just correct my mistake.
    Jared

  • Clear empty disk space

    When I use Disk Utility to Erase free space on my hard disk my whole mac grind to a holt with constant messages of 'your HD is almost full' - now it's obviously to do with how it clears the disk space but is there any way of stopping in grinding to a holt so early in the process and not alowing any apps to work?

    Why are you erasing blank space?
    If you are getting a hard drive full error, then you need to delete some files. You need ~10% of your hard drive free for the System and applications to work their behind the scenes magic.
    Disk Utility is usually run to fix problems, if you have other applications open DU will very aggressively take control of your hard drive. Don't run it with other applications open!

  • JWindow shows just an empty square

    Below i will give two classes. They works fine except one thing - when i push button, JWindow appears, but it is empty. Why? If I put a code from work() method to main() everything works perfect. Can someone help and explain what to do?
    This class works fine
    package bin;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.Toolkit;
    import javax.swing.ImageIcon;
    import javax.swing.JWindow;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Indikatorius implements Runnable{
         private static final long serialVersionUID = 1L;
         private ImageIcon ii = new ImageIcon("Menas/Indikatorius.gif");
         private JLabel l = new JLabel("TEST");
         private Container contentPane;
         private Frame f;
         private JWindow window;
        public Indikatorius(Frame owner) {
             f = owner;
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              window.setLocation((dim.width-window.getWidth())/2, (dim.height-30-window.getHeight())/2 );
        private void sukurk(){
             window = new JWindow(f);
             contentPane = window.getContentPane();
             contentPane.setLayout(new BorderLayout());
             contentPane.add(l, BorderLayout.CENTER);
             window.setAlwaysOnTop(true);
             window.pack();
             centruok();
             window.setVisible(true);
        public void kill(){
             window.dispose();
        public void run(){
             sukurk();
        public static void main(String[] args) throws InterruptedException{
             Indikatorius i = new Indikatorius(null);
             Thread t = new Thread(i);
             t.start();
             t.join();
             t.sleep(5000);
             i.kill();
    }This - not.
    package bin;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame implements ActionListener{
         * Creates a new instance of <code>Test</code>.
        private JButton b = new JButton("push me");
        public Test() {
             setSize(400,600);
             getContentPane().setLayout(new BorderLayout());
             getContentPane().add(b, BorderLayout.CENTER);
             b.addActionListener(this);
             centruok();
             setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        private synchronized void work() throws InterruptedException{
             Indikatorius i = new Indikatorius(this);
             Thread t = new Thread(i);
             t.start();
             t.join();
             t.sleep(5000);
             for (int j = 0; j < 1000; j++)
                  System.out.println("Numeris: "+j);
             i.kill();
             Thread.sleep(2000);
             setVisible(false);
             dispose();
        public void actionPerformed(ActionEvent e) {
             try{
                  work();
             catch(InterruptedException ie){
         * @param args the command line arguments
        public static void main(String[] args){
            // TODO code application logic here
            new Test();
    }

    If someone want a working waiting window - feel free to use
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.Toolkit;
    import javax.swing.ImageIcon;
    import javax.swing.JWindow;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.border.BevelBorder;
    import javax.swing.BorderFactory;
    public class Indikatorius extends JWindow implements Runnable{
         private static final long serialVersionUID = 1L;
         private ImageIcon ii = new ImageIcon("Menas/Indikatorius.gif");
         private JLabel l = new JLabel(ii);
         private Container contentPane;
        public Indikatorius(JFrame owner) {
             super(owner);
             setSize(200, 200);
             contentPane = getContentPane();         
             ((JPanel)contentPane).setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
             contentPane.add(l, BorderLayout.CENTER);
             setAlwaysOnTop(true);
             centruok();         
             //setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        public void run(){
             setVisible(true);
    }AND
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame implements ActionListener{
      private JButton b = new JButton("push me");
        public Test() {
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
             setSize(400,600);
             getContentPane().setLayout(new BorderLayout());
             getContentPane().add(b, BorderLayout.CENTER);
             b.addActionListener(this);
             centruok();
             setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        public void actionPerformed(ActionEvent e){
             final Indikatorius ind = new Indikatorius(this);
             Thread appThread = new Thread(){
                  public void run(){
                       try{
                            //SwingUtilities.invokeAndWait(ind);
                            SwingUtilities.invokeLater(ind);
                            for (int j = 0; j < 100; j++)
                                 System.out.println("Numeris: "+j);
                       catch (Exception e){
                            e.printStackTrace();
                       //System.out.println("Finished on " + Thread.currentThread());
                       for (int j = 0; j < 1000; j++)
                            System.out.println("Numeris: "+j);
                       ind.dispose();
            appThread.start();
         * @param args the command line arguments
        public static void main(String[] args){
            // TODO code application logic here
            new Test();
    }

  • White empty squares on monitor ?

    My macBook air has white empty spaces instead of the content such as the econ for the hard drive, mail, etc. it also crashes mail and safari often. Can anyone make a suggestion?

    Sorry I meant to mark your suggestion with a green check but i made a mistake and i don't know how to fix it.  I also had  deleted everything I could and there may have been something that was causing the proplem. thanks 
    again.

  • Photos "disappear", all that's left is are empty squares

    I have this really strange problem that some pictures (wasn't able to detect a pattern) are no longer shown in the "main" screen of iPhoto. But instead, there are weird sort of space-holders. If I double click on the squares, the normal pic opens and I can work with it normally.
    Why does this happen? How can I change this?
    Screenshot:
    http://intern.muenchener-bachchor.de/home/arichter/Bild1.png

    Launch iPhoto while depressing the option (alt) and command (apple) keys - use the rebuild thumbnails option first - if that does not fix it do it again and use all options
    LN

  • When I import photos from my digital camera in iPhoto 7.1.5 all i get is empty squares. Used to work great

    Just recently, I went to import some photos from my digital camera into my iPhoto 7.1.5 version on my Mac. All I am getsting is the amount of pictures on the camera in the shape of blank picture holders on the screen.  I hooked up the same camera to our son's mac and it has no problem importing pictures. I had some on a USB stick and am having the same problem.

    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • HT4061 Why I cannot open the apps store?...when I click on App Store I am getting a large empty square

    Why can I not open the Apps Store as usual?

    Close the App Store and reboot the iPad. Assuming you are running iOS 7 ....
    Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the App Store app and then swipe "up" on the app preview thumbnail to close it.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • Help Clearing Empty Lines

    Hello!
    I have created a rather complex form for our team members to be able to complete their inspections in the field using a Tablet PC.
    In order to make this easier for them I have populated about 50 different drop down menus with the various choices that apply to each scenario.
    These choices are then transported from their "list box" down to a comments section on the second page of the form.
    This comments section is a long string of this.rawValue = ListBox1.rawValue + "\n" + ListBox2.rawValue + "\n" etc.. etc. on down the line.
    The problem I am having is that by inserting all of these "\n".... by the time I get to the last couple of selections they are no longer fitting on the visible portion of the comments section.
    This is compounded by the fact that if one of these selections is not made, say the "violation" was not observed at this location, then I get a blank line for that value... obviously this is from my "\n".
    I can go back in at the end of the inspection and delete those rows manually, but I am hoping there is a possibility of perhaps creating a button or inserting an additional script onto my textbox that will allow this cleanup to occur? A single button click is much more user friendly and less prone to producing errors than having the inspectors do the cleanup on each document.
    I am also very open to any other suggestions that anyone here may have regarding an alternative way to format this text box so that each violation still shows on its own line, but does not generate that blank line when it is not activated. I was considering using an if else statement but am a little unsure as to how to format that without overwriting the rawValue each time a new selection is added.
    Thanks in advance for your assistance. I would be happy to upload the form if that becomes necessary.

    You can use a regular expression to clean up you comments field.
    This sample will look for all line breaks (\n) and carriage returns (\r) that occure between 2 and ten times and replaces them with one singe line break.
    Textfield.rawValue = Textfield.rawValue.replace(/\r{2,10}|\n{2,10}/gm, "\n");

  • Clear Print Queue HP P1102w LaserJet

    After printing to my wireless HP P1102w LaserJet, the print queue does not clear/empty.  So, when I print, again, the printer does not respond because there are queued docs to print, yet.  I can physically delete the queue, but this is cumbersome.  And, I am not the only user of the printer. It took forever to get the proper drivers loaded by using Apple Update.  Finally, the printer prints, whether using wireless or Wi-Fi. But, the document remains in the queue. Any ideas?  Or, is this an HP problem?

    I just went through this myself. It is basically as fede says. You need cups installed and running, and hplip installed. Some of the printers require a plugin (like my LaserJet 1018), and that may be why you get the message 'filter failed'. I got it too.
    You have to run hp-setup to get the plugin BUT hp-setup won't run properly without a /usr/bin/python symlinked to python2.7 . Either create that symlink or as fede says, if you already have one that points to python3, delete that symlink and create a new one pointing to python2.7, and then run hp-setup. It will run fine and your printer should work.
    On my other computer I have Ubuntu 12.10 and I noticed they have /usr/bin/python symlinked to python2.7 as a standard, that's why hp-setup ran correctly on it the first time. When I did a basic install of Arch recently it only installed python2, but there was no symlink of python -> python2.7 included in the package. If you install python3 (also known as python), you get the symlink of python -> python3. It's all a bit confusing, but I think if we only have python2 installed it might be a good idea to include the symlink python -> python2.7 in the package. Seems to me this confusion has been going on for a couple of years? I think I will leave my symlink python -> python2.7 in place.
    Last edited by nirvanix (2012-11-20 01:20:54)

Maybe you are looking for