Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8053627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:54:48+00:00 2026-06-05T07:54:48+00:00

I really don’t understand the striping behaviour resulting from the following code. I had

  • 0

I really don’t understand the striping behaviour resulting from the following code. I had rather hoped to see the top half of the bitmap in white, and the bottom half in black. I think I may have misunderstood something fundamental here. Any help gratefully received.

import numpy
import wx

class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
    wx.Frame.__init__(self, parent, id, title, size = (135,655))

    width = 128
    height = 640
    color = (255,255,255)

    array = numpy.zeros((width,height,3),'uint8')
    array[:,:,] = color
    print array[10,10,0]
    array[0:128,0:320,0:3] = 0
    print array[10,10,0]
    image = wx.EmptyImage(width,height)
    image.SetData(array.tostring())
    self.bitmap = image.ConvertToBitmap()
    wx.EVT_PAINT(self, self.OnPaint)

    self.Centre()

def OnPaint(self, event):
    dc = wx.PaintDC(self)
    dc.DrawBitmap(self.bitmap,3,10)

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, '2DS')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:54:49+00:00Added an answer on June 5, 2026 at 7:54 am

    If you initialise your numpy array numpy.zeros((height,width,3),'uint8') and slice the array array[0:320,0:128,0:3] (height then width) you should get what you were expecting.

    The case in your example you have 128 rows down, with 640 columns (basically width of 640 and height of 128 in your array). because the bitmap was 128 wide, the width of 640 was wrapping onto 5 lines (640/128) so you were making the left hand side of the image black and the right white, but because the lines were wrapping you got that zebra effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really don't understand regular expressions and was wondering what the following regular expressions
I use this code to get Server Date but I really don't understand.CreateDateTime() is
I really don't understand why I get a different response from xhrPost with Dojo.
I really don't have any reference, neither a sample code (searched in Google &
I really don't understand this. I have a simple ASP with 3 div in
Sorry i really don't know how to code in PHP but i need to
I really don't understand what I'm doing wrong, but according to Adobe, this is
I really don't understand why do we need to create channel.html file, as mentioned
I really don't see a sane use for these. There is already rescue and
I've got a strange problem and really don't understand what's going on. I made

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.